If the user is in fact using a KSH/Korn shell, the problem may not be the ==
, but instead the lack of double quotes, as many of the AT&T standards now take the ==
per the --posix
or -o posix
flags set. (These two flags force KSH to utilize posix standards)
Long story short, you should use:
if [ "$instance" = "ALL" ]; then
The double quotes protect against cases of null
or otherwise empty
strings, which would most likely throw an error, even if syntax was correct.
Bonus: It's not that KSH lacks support for ==
it's that KSH lacks support for null
and empty
objects/returns.
For more information on this, you can check out the main KSH page, or Peter Seebach's book on Portable Shell Scripting or even the O'Reilly Bash Cookbook, and finally the Korn Shell book by O'Reilly which I happened to find a freely accessible short link of some of these logical operands here :)