use of :

作者: lucientlau | 来源:发表于2017-12-12 10:39 被阅读0次

    : nop command

    :
    echo $?  # 0
    

    $? the previous command return value

    Dead loop

    while :
    do 
       operation-1
      .
      .
      .
    done
    

    the same with

    while ture
    do
    
    done
    
    

    Another example

    if condition
    then :
    else
      take some action
    fi
    
    : ${username=`whoami`}
    

    Clear file

    : > file
    cat /dev/null > file
    

    相关文章

      网友评论

          本文标题:use of :

          本文链接:https://www.haomeiwen.com/subject/ovygixtx.html