开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜