Test your square brackets!

A shell story about how to test things when doing scripting. Test your square brackets! I do shell scripting everyday, and I’m so used to the usage of square brackets when performing some test, that I forgot the whole story. I assume you know that something like the following performs what it seems to do: if [ -f " $file " ] ; then echo "The file exists, avoid overwriting it!" exit 2 fi The…