Please please please please please use double quotes around variables, unless you explicitly desire the shell to interpret the variable value. A simple example to illustrate the issue:
$ mkdir test_shell_behavior &&cd$_$ touch'foo''xyz 123'$ for file in*;do cp$file$file.bak;done
cp: target '123.bak' is not a directory
$ ls
foo foo.bak xyz 123
$ rm foo.bak
$ for file in*;do cp"$file""$file".bak;done$ ls
foo foo.bak xyz 123 xyz 123.bak
Nice list.
Please please please please please use double quotes around variables, unless you explicitly desire the shell to interpret the variable value. A simple example to illustrate the issue:
See this Q&A on unix.stackexchange and wooledge: Quotes for more details.
You can also use
man -k
instead ofapropos
For testing shell globs, you can use
echo
I definitly recommand ${variable}, much better to look and feel more like you can't be wrong about it :)
Cool! Thanks for the feedback, that is good advice. 🤠