Linux: shell: bash: set -x;调试使用

man bash

set -x

-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.

这个可以帮助将变量的实际赋值情况打印出来。帮助调试使用,实现了单步调试的功能。非常的方便。

https://stackoverflow.com/questions/38335552/how-to-store-exclude-arguments-for-grep-in-an-environment-variable-in-a-bash-s/79259586#79259586

比如上面这个问题,就可以使用。但是首先需要有这个意识,这个知识,知道这个途径。

相关推荐
Y_Hungry6 小时前
Linux 怎么使用局域网内电脑的网络访问外部
linux·运维·服务器
10000hours6 小时前
【C语言编译】编译原理和详细过程
linux·c语言·笔记
小小不董7 小时前
Oracle OCP认证考试考点详解083系列06
linux·数据库·oracle·dba
网硕互联的小客服7 小时前
如何解决服务器文件丢失或损坏的问题
运维·服务器
Shanxun Liao7 小时前
如何在 PowerEdge 服务器上设置 NIC 分组
运维·服务器
一道秘制的小菜7 小时前
AimRT从入门到精通 - 03Channel发布者和订阅者
linux·服务器·c++·vim·aimrt
开开心心就好8 小时前
提升办公效率的PDF转图片实用工具
运维·服务器·网络·python·智能手机·pdf·ocr
茅坑的小石头8 小时前
linux tar命令详解。压缩格式对比
linux·运维·服务器
球求了8 小时前
Linux 入门:操作系统&&进程详解
linux·运维·服务器·开发语言·学习
李匠20248 小时前
C++负载均衡远程调用学习之负载均衡算法与实现
运维·c++·学习·负载均衡