CSH Group Existance Test With Value Test
In CSH, is it possible to nest the test for an existance of a variable with the test for its value in the same if-clause?
#!/bin/csh
# This seems to work...
if ( $?VAR ) then
echo "VAR exists"
if ( $VAR == true ) th开发者_运维问答en
echo "VAR is true"
endif
endif
# I want something more like this:
if (( $?VAR ) && ( $VAR == true )) then
echo "VAR exists and is true"
endif
Short-circuit evaluation is one of the many things that C shell doesn't do. You will have to use nested if
statements or switch shells.
精彩评论