News for hackers. Stuff that matters.
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.
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.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by astrodust on Monday September 05, 2016 @07:32AM (#12429548)
Anyone who's done even a trivial amount of programming in the shell knows to do: [ "$x" == "" ]
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by kqr on Saturday September 17, 2016 @02:24PM (#12521697)
That does not help, as far as POSIX is concerned.

    $ [ "$x" == "" ]
    sh: 2: [: unexpected operator