I am having some trouble understand test command in shell scripting.
From this piece of code here:
if [ ! "$n_trig" -a "$i_trig" ]
then
usage
echo "Required options -n and -i are not present"
exit 1
fi
I would expect the command list in the if statement to be executed since n_trip and i_trig are both set to false.. However it does not execute. If I remove ! it does. I don't understand why.
Here is the output of sh -x ./script:
+ n_trig=false
+ i_trig=false
+ p_trig=false
+ getopts n:i:p: opt
+ '[' '!' false -a false ']'