This is my code:
echo $1 $2
if [ "Release"!="$2" -a "Debug"!="{$2}" ]; then
echo "error! the arg of -c must be \"Release\" or \"Debug\" !"
exit 1
fi
XCODECONFIG="$2";
when I input
./build.sh a Release
the output is:
a Release
error! the arg of -c must be "Release" or "Debug" !
it prints “error! the arg of -c must be “Release” or “Debug” !” why doesn’t go on to XCODECONFIG=”$2″?
There must be spaces around
!=:When you write your expression without spaces, it is syntaticaly correct, but means other thing. It looks like:
In your case, there are != inside, but that means nothing; that is anyway just strings; each string is evaluated as true, and
True -a Truewill be also evaluated as true.