by cmma · 11y ago · 0 comments
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
# 4No comments yet.