On Fri, Feb 13, 2015 at 11:54 PM, Always Learning centos@u64.u22.net wrote:
And third, you generally should use double quotes around variables in tests so they continue to exist as an empty string if the variable happens to not be set.
Thanks for that. I assumed if test 1 worked, so would test 2.
Have re-run test 2 with
16 if [ $file = "law00css" ]
You still missed the part about quoting variables. You quote plain strings to hold embedded spaces together (or single-quotes to avoid parsing metacharacters). You use double quotes around $variables so they don't disappear completely if the variable isn't set, causing a syntax error. To understand it completely you need to know the order of operations as the shell makes multiple passes over the line, parsing, processing metacharacters, and expanding variables. And I don't know where to find a concise description of that any more.