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

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

相关推荐
張萠飛9 分钟前
Linux中程序的limits中的Max open files的配置由哪些参数决定
linux·运维·服务器
KoiHeng3 小时前
操作系统简要知识
linux·笔记
Johny_Zhao6 小时前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
小毛驴8507 小时前
Linux 后台启动java jar 程序 nohup java -jar
java·linux·jar
一心0928 小时前
ubuntu 20.04.6 sudo 源码包在线升级到1.9.17p1
运维·ubuntu·sudo·漏洞升级
好好学习啊天天向上8 小时前
世上最全:ubuntu 上及天河超算上源码编译llvm遇到的坑,cmake,ninja完整过程
linux·运维·ubuntu·自动性能优化
你想考研啊8 小时前
三、jenkins使用tomcat部署项目
运维·tomcat·jenkins
tan180°9 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
代码老y9 小时前
Docker:容器化技术的基石与实践指南
运维·docker·容器
典学长编程9 小时前
Linux操作系统从入门到精通!第二天(命令行)
linux·运维·chrome