Linux set command All In One
1.Linux shell command ln All In One2.Linux shell command cut All In One3.Linux shell standard input bugs All In One4.Linux shell command base64 All In One5.How to use the shell command to get the version of Linux Distributions All In One6.Linux shell command make & Makefile All In One7.Linux shell command strings All In One8.sudo & su & Rust All In One9.Linux shell command make All In One10.Linux shell script shebang env All In One11.Linux shell script switch...case All In One12.Linux shell command ls sort by date All In One13.Linux shell script read file line by line All In One14.Linux shell regular expression All In One15.How to fix IP filter regular expressions written using grep command in Linux shell script All In One16.Linux shell script programming All In One17.Linux shell script redirection All In One18.How to use Linux shell command filter the IP address All In One19.how to create one interactive mode command line configuration tool with shell language on Linux All In One20.Linux shell script get date and time All In One21.Linux shell command screen All In One22.Linux shell `#!` interpreter All In One23.Linux shell set command All In One24.Linux shell script auto generate batch files All In One25.Linux bash script HereDoc All In One26.Linux shell system environment variables All In One27.Linux shell command curl All In One28.Linux shell command chroot All In One29.Linux shell command chmod All In One30.Linux shell number variables add All In One31.Linux bash shell "${1}" All In One32.Linux xattr shell command All In One33.Multiple Ways to Change Terminal Shell in Linux All In One34.Linux shell stdin & stdout & stderr All In One35.Linux shell man command All In One36.Linux shell command line editor All In One37.Linux shell command uname All In One38.Linux bash shell script block comment All In One39.Linux bash shell script batch download files All In One40.Linux shell script bug and error All In One41.Linux bash write long string with multi-lines comments All In One
42.Linux set command All In One
43.Linux echo command All In One44.Linux echo 换行 All In One45.Linux Bash shell 脚本定时器 All In One46.Linux System Variables All In One47.linux bash shell auto read write template48.Linux bash script read args All In One49.Linux Bash Script conditions syntax All In One50.Linux Bash Script loop syntax All In One51.Linux shell script All In One52.如何通过 Linux terminal 查看一个文件的 meta 信息 All In One53.Linux shell uname -a All In One54.Linux shell command create file methods All In One55. how to write string to file in linux bash All In One56.linux bash shell & lsof & grep & ps57.Linux Bash Shell All In One58.Linux shell command copy file All In One59.Linux shell command & zip & tar All In One60.Linux shell command show project directory tree All In One61.Linux shell commands man chmod All In One62.Linux & bash & shell & PID & PPID63.Linux bash shell All In One64.Linux shell command symbolic link & soft link All In One65.Linux bash shell All In One66.Linux shell (.sh 文件) 基础命令 常用命令 汇总67.How to use a shell script to check whether a command had been installed in the Linux server All In One68.How to print a string with a variable by using the echo command in the shell script All In One69.Linux install vim errors All In OneLinux set command All In One
set -eux
$ set -eux
# -e 若指令传回值不等于0,则立即退出shell。
# -u 当执行时使用到未定义过的变量,则显示错误信息。
# -x 执行指令后,会先显示该指令及所下的参数。
$ man set
$ set --help
set: set [--abefhkmnptuvxBCHP] [-o 选项名] [--] [参数 ...]
设定或取消设定 shell 选项和位置参数的值。
改变 shell 选项和位置参数的值,或者显示 shell 变量的
名称和值。
选项:
-a 标记修改的或者创建的变量为导出。
-b 立即通告任务终结。
-e 如果一个命令以非零状态退出,则立即退出。
-f 禁用文件名生成(模式匹配)。
-h 当查询命令时记住它们的位置
-k 所有的赋值参数被放在命令的环境中,而不仅仅是
命令名称之前的参数。
-m 启用任务控制。
-n 读取命令但不执行
-o 选项名
设定与选项名对应的变量:
allexport 与 -a 相同
braceexpand 与 -B 相同
emacs 使用 emacs 风格的行编辑界面
errexit 与 -e 相同
errtrace 与 -E 相同
functrace 与 -T 相同
hashall 与 -h 相同
histexpand 与 -H 相同
history 启用命令历史
ignoreeof shell 读取文件结束符时不会退出
interactive-comments
允许在交互式命令中显示注释
keyword 与 -k 相同
monitor 与 -m 相同
noclobber 与 -C 相同
noexec 与 -n 相同
noglob 与 -f 相同
nolog 目前可接受但是被忽略
notify 与 -b 相同
nounset 与 -u 相同
onecmd 与 -t 相同
physical 与 -P 相同
pipefail 管道的返回值是最后一个非零返回值的命令的返回结果,
或者当所有命令都返回零是也为零。
posix 改变默认时和 Posix 标准不同的 bash 行为
以匹配标准
privileged 与 -p 相同
verbose 与 -v 相同
vi 使用 vi 风格的行编辑界面
xtrace 与 -x 相同
-p 无论何时当真实的有效的用户身份不匹配时打开。
禁用对 $ENV 文件的处理以及导入 shell 函数。
关闭此选项会导致有效的用户编号和组编号设定
为真实的用户编号和组编号
-t 读取并执行一个命令之后退出。
-u 替换时将为设定的变量当作错误对待。
-v 读取 shell 输入行时将它们打印。
-x 执行命令时打印它们以及参数。
-B shell 将执行花括号扩展。
-C 设定之后禁止以重定向输出的方式覆盖常
规文件。
-E 设定之后 ERR 陷阱会被 shell 函数继承。
-H 启用 ! 风格的历史替换。当 shell 是交互式的
时候这个标识位默认打开。
-P 设定之后类似 cd 的会改变当前目录的命令不
追踪符号链接。
-T 设定之后 DEBUG 陷阱会被 shell 函数继承。
-- 任何剩余的参数会被赋值给位置参数。如果没
有剩余的参数,位置参数不会被设置。
- 任何剩余的参数会被赋值给位置参数。
-x 和 -v 选项已关闭。
使用 + 而不是 - 会使标志位被关闭。标志位也可以在
shell 被启动时使用。当前的标志位设定可以在 $- 变
量中找到。剩余的 ARG 参数是位置参数并且是按照
$1, $2, .. $n 的顺序被赋值的。如果没有给定 ARG
参数,则打印所有的 shell 变量。
退出状态:
返回成功除非使用了无效的参数。
Linux set命令用于设置shell
set指令能设置所使用shell的执行方式,可依照不同的需求来做设置。
# 参数说明:
-a 标示已修改的变量,以供输出至环境变量。
-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 执行指令后,会先显示该指令及所下的参数。
+<参数> 取消某个set曾启动的参数。
refs
https://www.runoob.com/linux/linux-comm-set.html
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/15541757.html
未经授权禁止转载,违者必究!
合集:
Linux Shell
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2020-11-11 js sort map by key
2020-11-11 shit LeetCode interview Question All In One
2020-11-11 LeetCode 题解 593. Valid Square (Medium)
2020-11-11 隐私协议 All In One
2019-11-11 Flutter & Open JDK
2019-11-11 ESLint & React
2019-11-11 React Fiber 架构 All In One