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

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

相关推荐
ManageEngineITSM14 小时前
技术的秩序:IT资产与配置管理的现代重构
大数据·运维·数据库·重构·工单系统
阿巴~阿巴~16 小时前
线程安全单例模式与懒汉线程池的实现与优化
linux·服务器·单例模式·线程池·饿汉模式·懒汉模式·静态方法
大隐隐于野16 小时前
tcp 丢包分析
linux·服务器·网络
梦昼初DawnDream16 小时前
linux安全基线
linux·运维·安全
Broken Arrows16 小时前
在Linux系统中,top命令的显示参数详解
linux·运维·服务器
qq_4017004117 小时前
I.MX6U 启动方式详解
linux
code-vibe19 小时前
物理机 kali 改造笔记 (一)
linux·运维·服务器
小坏讲微服务19 小时前
五分钟使用 Docker-compose搭建 Redis 8.0 中间件
运维·redis·docker·中间件·容器·kubernetes·k8s
老黄编程19 小时前
03-gpg(证书管理 )详细范例
linux·运维·ubuntu·数字证书
Aimyon_3619 小时前
MinerU Docker自定义版本部署
运维·docker·容器