3 ms·
The article only considers quoted arguments. Quoting should be recommended for test, and OP probably even has a formal check for quotes being in place. However,
by patal 6y ago
The article only considers quoted arguments. Quoting should be recommended for test, and OP probably even has a formal check for quotes being in place. However, let's just set that aside for now. Quotes are optional. And if you don't put quotes, then yes, you need to use `[ x$var = xval ]` to address empty variables.
- tinus_hn 6y agoI wonder what happens when $var starts with ‘-‘, it wouldn’t surprise me if it’s taken as an option.
- dolmen 6y agoIt's time to read the article.
- tinus_hn 6y agoAh, upon rereading it turns out it is still an issue: ... would fail to run test commands whose left-hand side matched a unary operator. This was fixed [...] in 1979. However, test and [ were also available as separate executables, and appear to have retained a variant of the buggy behavior: