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

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

相关推荐
智恒百亿28 分钟前
RTX 5090 八卡服务器 vs RTX PRO 6000 整机:AI 推理、微调与渲染选型部署指南
运维·服务器·rtx5090
DYWorker0011 小时前
Linux驱动子系统:DMA-Buf —— Consumer和Provider(008)
linux·驱动开发
雯宝2 小时前
Linux 内核函数集
linux
GeW2 小时前
从挂科到高分通过:RHCE快速拿证的10个提分技巧
linux
蓝胖的四次元口袋2 小时前
Docker Compose多容器编排与Nginx集群实战
运维·nginx·docker compose
懂软件的胡子个哥3 小时前
微信 API 消息回调怎么设计,才能避免丢消息和重复处理
运维·微信·架构·wechatapi·个人微信号二次开发
吉甫作诵3 小时前
Redis 常用命令大全:11 大类命令速查手册
运维·数据库·redis·缓存·nosql
鸠摩智首席音效师3 小时前
Linux /etc/nsswitch.conf 文件有什么作用 ?
linux
东城居士3 小时前
理解pinctrl和gpio子系统驱动
linux·嵌入式系统
H_oRIZoN_3 小时前
Linux入门DAY43 ARM 架构基础、寄存器、大小端、异常向量、交叉编译
linux·arm·linux应用编程