Filenames can contain newlines?
You learn something new (and vaguley horrifying) every day.
You learn something new (and vaguley horrifying) every day.
For example, to delete all .o files in the current directory and its subdirectories:
find . -name "*.o" -print0 | xargs -0 rm -f find . -name "*.o" -delete
?Or, you can use zsh.
rm **/*.o
grep foo **/*.{java,sql,xml}
# Where is that blasted IBM utility?
ls **/*pmt*(x.) # list e(x)ecutable files (.) that have "pmt" in their name.
# Show me all the "Setup" dirs in my project
ls -d **/Setup(/)$> touch -- --
$> rm --
usage: rm [-f | -i] [-dPRrvW] file ... unlink file
$> rm -- --
$> touch \
$> touch \\ \ \ . \-
favorites of malware authors everywhere.
Actually the Mac uses (or at least "used") a hidden files named "Icon\r" (yes, an embedded carriage return) for its custom folder icons. I'm still not sure that counts as "legitimate".
desktop=$(test -z $(ls -A1 /Volumes/Documents/Desktop | \
sed -e '/^.DS_Store$/d' -e '/^Icon^M$/d'))
The ^M was a literal CR, which would get munged by all my usual editors except vim. I'm sure there's some sturdier way to escape it...I remember choosing to use ls intentionally, but not what sucked about the alternatives.