加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

将-xe参数传递给/ bin / bash的做法是什么

发布时间:2020-12-15 18:44:30 所属栏目:安全 来源:网络整理
导读:正是标题所说的.我没有太多运气找到正确的文档来查看-xe在以下用例中的作用: #!/ bin / bash -xe 这些参数做了什么以及记录在哪里? 如果您阅读了bash的手册页,您将在OPTIONS部分的顶部找到以下内容: All of the single-character shell options document
正是标题所说的.我没有太多运气找到正确的文档来查看-xe在以下用例中的作用:

#!/ bin / bash -xe

这些参数做了什么以及记录在哪里?

如果您阅读了bash的手册页,您将在OPTIONS部分的顶部找到以下内容:
 All of the  single-character shell options documented in the
 description of the set builtin command can be used as options when the
 shell is invoked. In addition,bash interprets the following options
 when it is invoked...

如果您稍后在手册页中阅读了set命令的文档,您会发现:

 -e      Exit  immediately  if a pipeline (which may consist of a
 single simple command),a subshell command enclosed in parentheses,or one of the commands executed as part of a command list enclosed by
 braces (see SHELL GRAMMAR above) exits with a non-zero  status. 

 -x      After expanding each simple command,for command,case
 command,select command,or arithmetic  for  command,display
 the  expanded value of PS4,followed by the command and its
 expanded arguments or associated word list.

换句话说,-e使shell立即退出某些东西会返回一个错误(这通常在shell脚本中用作故障保护机制),-x允许详细执行脚本你可以看到发生了什么.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读