I'm writing a larger bash script, and I've found this snippet to test if a directory exists case insensitive
Now, if I now have one directory called subs this script will print the path, and if I have two (or more) it will print those too..
but I don't really understand how, since there is only 1 print function, and no loop?
I guess it has something to do with the '\t%s\n' "$@" code... someone that can explain this to me? (trying to understand)
dir=~/test1 shopt -s nullglob nocaseglob set -- $dir/[s]ubs/ if [ "$#" -gt 0 ]; then echo 'There is at least one directory called "subs" (case ignored):' printf '\t%s\n' "$@" fi