3 ms·
> You say you can do "some_command * .mp3"...true if either a) your command is safe to run with garbage input or b) you know that you have >= one file and no wh
by cmma 11y ago
> You say you can do "some_command * .mp3"...true if either a) your command is safe to run with garbage input or b) you know that you have >= one file and no whitespace in filenames.
Globbing preserves whitespace. It's up to the target function to discard it, by forgetting to quote arguments.
example1() {
[ $# -eq 0 ] && return
echo "$1"
shift
example1 "$@"
}
example2() {
for arg in "$@"; do
echo "$arg"
done
}
touch 1 "2 3" 4
example1 *
example2 *
# both examples print:
# 1
# 2 3
# 4