3 ms·
I think you meant “=”, not “==” (though the latter would work with bash).
by Arkanosis 11y ago
I think you meant “=”, not “==” (though the latter would work with bash).
- viraptor 11y agoWell, either in the example. Parent was saying "Reminds me on bash" For sh version, I'd go with super-safe: if test "x$1" = "x$2"
- seanp2k2 11y agoIf you're doing that, even better to use "x${1}" to be safer. Also, conditional expressions ( [[ instead of [ or `test`) are generally a bit more well-behaved. See http://wiki.bash-hackers.org/syntax/ccmd/conditional_expression http://wiki.bash-hackers.org/syntax/ccmd/conditional_express... for more info.
- viraptor 11y agoBut [[ is a bashism - it won't work on bare sh.