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

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

相关推荐
念恒12306几秒前
Linux基础开发工具(git篇)
linux·c语言·git
Cyber4K7 分钟前
【Nginx专项】高级进阶架构篇-Proxy正反向代理、FastCGI及PHP-FPM介绍
运维·服务器·nginx·架构·php
墨^O^7 分钟前
C++ Memory Order 完全指南:从 relaxed 到 seq_cst,深入理解无锁编程与 happens-before
linux·开发语言·c++·笔记·学习·算法·缓存
returnthem11 分钟前
【Linux基础知识】Linux自动化运维:编写Shell脚本实现自动化任务
linux·运维·自动化
天月风沙13 分钟前
Betaflight飞控、树莓派RP2350B主控编译教程
linux·单片机·嵌入式硬件·mcu·无人机·树莓派
实在智能RPA14 分钟前
零售行业上线Agent,能带来哪些运营价值?——2026年视角下的端到端智能自动化深度拆解
运维·自动化·零售
su_ym811015 分钟前
Android 与 Linux 对比
android·linux·framework
默|笙17 分钟前
【Linux】线程同步与互斥_日志与线程池
android·linux·运维
一条咸鱼¥¥¥20 分钟前
【运维笔记】华为防火墙远程接入用户开通与禁用方法
运维·网络·华为·远程用户
Asurplus22 分钟前
【Ngrok】Linux运行内网穿透工具Ngrok
linux·运维·服务器·内网穿透·ngrok