1

If Statement with 2 Variables - Bash

view story
linux-howto

http://serverfault.com – I am trying to write a single IF statement which can check two variables at once. I have two variables, for example: $VARA $VARB Both with either contain a 0 or a non 0 value. I need an if statement which can check both and if either are not equal to 0, if will perform an action, if both are 0 if will perform a different action. With a single variable, I can do this: if [ $VARA -ne 0 ] then echo 'The operation failed! VARA is not equal to 0' else echo 'The operation suceeded! VARA is equal to 0' fi However, I am not sure how to check both VARA and VARB at the same time. Thank you. (HowTos)