代码之家  ›  专栏  ›  技术社区  ›  Nate

CSH群存在性检验与值检验

csh
  •  2
  • Nate  · 技术社区  · 14 年前

    #!/bin/csh
    
    # This seems to work...
    if ( $?VAR ) then
        echo "VAR exists"        
        if ( $VAR == true ) then
            echo "VAR is true"
        endif
    endif
    
    # I want something more like this:
    if (( $?VAR ) && ( $VAR == true )) then
        echo "VAR exists and is true"
    endif
    
    1 回复  |  直到 14 年前
        1
  •  2
  •   Dennis Williamson    14 年前

    短路评估是 many things that C shell doesn't do if 语句或开关外壳。