Bash Boolean testing
问题 I am attempting to run a block of code if one flag is set to true and the other is set to false. ie var1=true var2=false if [[ $var1 && ! $var2 ]]; then var2="something"; fi Since that did not evaluate the way that I expected I wrote several other test cases and I am having a hard time understanding how they are being evaluated. aa=true bb=false cc="python" if [[ "$aa" ]]; then echo "Test0" ; fi if [[ "$bb" ]]; then echo "Test0.1" ; fi if [[ !"$aa" ]]; then echo "Test0.2" ; fi if [[ ! "$aa" ]