Multiple expression if statement in Bash -
i recreate this
if ( arg1 || arg2 || arg 3) {}
and did got far, following error
line 11: [.: command not found if [ $char == $';' -o $char == $'\\' -o $char == $'\'' ] ...
i tried different ways none seem work some of ones tried
for bash, can use [[ ]]
form rather [ ]
, allows &&
, ||
internally:
if [[ foo || bar || baz ]] ; ... fi
otherwise, can use usual boolean logic operators externally:
[ foo ] || [ bar ] || [ baz ]
...or use operators specific test
command (though modern versions of posix specification describe xsi extension deprecated -- see application usage section):
[ foo -o bar -o baz ]
...which differently written form of following, deprecated:
test foo -o bar -o baz
Comments
Post a Comment