当前位置:网站首页>bash的命令退出状态码
bash的命令退出状态码
2022-08-11 05:33:00 【macob】
用$?查看脚本退出状态:echo $?
0 命令成功结束
1 一般性未知错误
2 不适合的shell命令
126 命令不可执行
127 没找到命令
128 无效的退出参数
128+x 与Linux信号x相关的严重错误
130 通过Ctrl+C终止的命令
255 正常范围之外的退出状态码
退出状态码126表明用户没有执行命令的正确权限。
exit
默认情况下, shell脚本会以脚本中的最后一个命令的退出状态码退出。
你可以改变这种默认行为,返回自己的退出状态码。 exit命令允许你在脚本结束时指定一
个退出状态码。
退出状态码只能在0~ 255的区间。超过这个区间 shell通过模运算得到状态码。一个值的模就是被除
后的余数。最终的结果是指定的数值除以256后得到的余数。
例如:exit 300
指定的值是300(返回值),余数是44,因此这个余数就成了最后的状态退出码。
边栏推荐
- (3) Software testing theory (understanding the knowledge of software defects)
- 无胁科技-TVD每日漏洞情报-2022-8-1
- 树莓派设置静态IP地址
- Solve the problem that port 8080 is occupied
- 勒索病毒eking.devos.mkp.makop.lockbit.eight.locked.roger等剖析及中毒文件恢复
- AUTOMATION DAY07 (Ansible Vault, ordinary users use ansible)
- SECURITY DAY02 (Zabbix alarm mechanism, Zabbix advanced operation and monitoring case)
- Threatless Technology-TVD Daily Vulnerability Intelligence-2022-8-6
- vnc remote desktop installation (available for personal testing on 2021-10-20)
- arcmap下的多进程脚本
猜你喜欢
AUTOMATION DAY07( Ansible Vault 、 普通用户使用ansible)
VMware workstation 16 installation and configuration
逐步揭示makop.mkp勒索病毒中毒防范恢复解密
Django QuerySet.order_by() SQL注入漏洞复现
ssh中的密码登录和密钥登录
查看CPU和其他硬件温度的软件
Solve win10 installed portal v13 / v15 asked repeatedly to restart problem.
VMware workstation 16 安装与配置
项目笔记——随机2
buildroot setup dhcp
随机推荐
Windos10专业版开启远程桌面协助
C语言两百题(0基础持续更新)(1~5)
无胁科技-TVD每日漏洞情报-2022-7-30
FusionCompute8.0.0 实验(2)虚拟机创建
HPC平台搭建
ETCD单节点故障应急恢复
lvm multi-disk mount, combined use
(一)软件测试理论(0基础了解基础知识)
CLUSTER DAY02( Keepalived热备 、 Keepalived+LVS 、 HAProxy服务器 )
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-30
ETCD集群故障应急恢复-本地数据可用
arcgis填坑_1
ovnif摄像头修改ip
内存调试工具Electric Fence
MoreFileRename batch file renaming tool
uboot code analysis 1: find the main line according to the purpose
SECURITY DAY01(监控概述 、 Zabbix基础 、 Zabbix监控服 )
mysql 中登录报错:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)ERROR
FusionCompute8.0.0实验(1)CNA及VRM安装
uboot sets the default bootdelay