zoukankan      html  css  js  c++  java
  • Linux Set Command

    1. set -e

    "Exit immediately if a simple command exits with a non-zero status."

    When this option is on, if a simple command fails for any of the reasons listed in Consequences of Shell Errors or returns an exit status value >0, and is not part of the compound list following a while, until, or if keyword, and is not a part of an AND or OR list, and is not a pipeline preceded by the ! reserved word, then the shell shall immediately exit.

    2. set -o pipefail

    "If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a  non-zero  status,or zero if all commands in the pipeline exit successfully.  This option is disabled by default."
    设置了这个选项以后,包含管道命令的语句的返回值,会变成最后一个返回非零的管道命令的返回值
    3. set -x

    show commands being executed

    4. set -u

    Treat unset variables as an error when performing parameter expansion.  If expansion is attempted  on  an  unset  variable,  the shell prints an error message, and, if not interactive, exits with a non-zero status.

    5. Others

     -b:使被中止的后台程序立刻回报执行状态
     -C:转向所产生的文件无法覆盖已存在的文件
     -d:Shell预设会用杂凑表记忆使用过的指令,以加速指令的执行。使用-d参数可取消。
     -e:若指令传回值不等于0,则立即退出shell。 
     -f:取消使用通配符。
     -h:自动记录函数的所在位置。
     -H Shell:可利用"!"加<指令编号>的方式来执行history中记录的指令。
     -k:指令所给的参数都会被视为此指令的环境变量。 
     -l:记录for循环的变量名称。 
     -m:使用监视模式。 
     -n:只读取指令,而不实际执行。
     -p:启动优先顺序模式。 
     -P:启动-P参数后,执行指令时,会以实际的文件或目录来取代符号连接。 
     -t:执行完随后的指令,即退出shell。 
     -u:当执行时使用到未定义过的变量,则显示错误信息。 
     -v:显示shell所读取的输入值。 
     -x:执行指令后,会先显示该指令及所下的参数。
  • 相关阅读:
    QQ聊天界面的布局和设计(IOS篇)-第二季
    关于UIButton中的ContentEdgeInsets的深入研究
    QQ聊天界面的布局和设计(IOS篇)-第一季
    UITextField实现过滤选中状态拼音
    UITableView系列(1)---Apple缓存池机制
    应用程序打包(ipa)
    线程篇-01-NSThread
    IOS开发错误提示原因集合-----长期更新
    Divide and Conquer.(Merge Sort) by sixleaves
    [已完成,附上实现方式]DWZ横向导航实现动态左菜单树
  • 原文地址:https://www.cnblogs.com/codingforum/p/6614018.html
Copyright © 2011-2022 走看看