views:

55

answers:

4

What does -a mean in the below line.

if [ "${FILE_SYSTEM}" != "xyz" -a "${FILE_SYSTEM}" != "abc" ]
+2  A: 

In shell script test (open brace) it means "and," so if the file system var does not equal xyz AND does not equal abc, the test succeeds.

tandu
`[` is a bracket, `{` is a brace
Dennis Williamson
+4  A: 

It means logical and operator.

If both the operands are true then condition would be true otherwise it would be false.

In your case the condition in the if will be true when variable $FILE_SYSTEM is not xyz and is not abc.

codaddict
+5  A: 

man test

 EXPRESSION1 -a EXPRESSION2
              both EXPRESSION1 and EXPRESSION2 are true
ghostdog74
A: 

An equivalent to

if [ "$x" != "a" -a "$x" != "b" ]; then
    do_one_thing
else
    do_other_thing
fi

is

case "$x" in
    a|b) do_other_thing ;;
    *)   do_one_thing ;;
esac
glenn jackman