Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by kqr on Monday September 05, 2016 @01:04AM
(#12428224)
A practise that may come from some shell scripting languages where `[ $x == "" ]` is an invalid command because empty strings aren't strings.
[ Parent
| on HN ]
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by _kst_ on Monday September 05, 2016 @04:24AM
(#12428893)
That may be true in older shells, but in modern shells [ $x == "" ] is valid, and "" is a single token whose value is the empty string. But I've seen old code that does things like
if [ x$x == "x" ] ; then ...
apparently because it was necessary at one time.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by kqr on Saturday September 17, 2016 @02:23PM
(#12521692)
It depends on what you mean by "older" shells. More modern shells tend to support this properly, but the baseline for most shell scripts is /bin/sh which is not guaranteed to be modern – it is often a new release of Sh.