문제

What does -a mean in the below line.

if [ "${FILE_SYSTEM}" != "xyz" -a "${FILE_SYSTEM}" != "abc" ]
도움이 되었습니까?

해결책

man test

 EXPRESSION1 -a EXPRESSION2
              both EXPRESSION1 and EXPRESSION2 are true

다른 팁

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.

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.

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top