(04-18-2023, 07:24 PM)Tim Curtis Wrote: - Right, quote the args.
Hi Tim,
actually, it's not just quoting, it is having something added to the variable, in order to not have an empty string on either side of the comparison:
I usually add an "x" before, and one after, the variable name (which needs then to be enclosed by curly braces in order to not change its name...).
Of course, the same has to be done with the literal string, hence the "x${MODEL}x" "x3x", so that in case $MODEL is empty, or undefined, the comparison still reads "xx" = "x3x", which will return false, of course, but won't confuse (ehm, crash) the bash parser.
Quoting is mandatory, of course.