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

什么设置-e和set -a在bash中做什么.我可以使用set命令的其他选项

发布时间:2020-12-15 22:26:14 所属栏目:安全 来源:网络整理
导读:我想知道下面命令在bash中做了什么. set -e 设置-a 我可以使用set的其他选项是什么,它们是什么意思. 解决方法 从 man page: -a Mark variables and function which are modified or created for export to the environment of subsequent commands -e Exit
我想知道下面命令在bash中做了什么.

> set -e
>设置-a

我可以使用set的其他选项是什么,它们是什么意思.

解决方法

从 man page:

-a Mark variables and function which are modified or created for export to the environment of subsequent commands

-e Exit immediately if a pipeline (see Pipelines),which may consist of a single simple command (see Simple Commands),a list (see Lists),
or a compound command (see Compound Commands) returns a non-zero
status. The shell does not exit if the command that fails is part of
the command list immediately following a while or until keyword,part
of the test in an if statement,part of any command executed in a &&
or || list except the command following the final && or ||,any
command in a pipeline but the last,or if the command’s return status
is being inverted with !. If a compound command other than a subshell
returns a non-zero status because a command failed while -e was being
ignored,the shell does not exit. A trap on ERR,if set,is executed
before the shell exits.

This option applies to the shell environment and each subshell
environment separately (see Command Execution Environment),and may
cause subshells to exit before executing all the commands in the
subshell.

If a compound command or shell function executes in a context where -e is being ignored,none of the commands executed within the compound command or function body will be affected by the -e setting,even if -e is set and a command returns a failure status. If a compound command or shell function sets -e while executing in a context where -e is ignored,that setting will not have any effect until the compound command or the command containing the function call completes.

(编辑:李大同)

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

    推荐文章
      热点阅读