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

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

相关推荐
私房菜几秒前
使用U盘安装 ubuntu 系统
linux·运维·ubuntu
江湖人称小鱼哥1 分钟前
基于DNS的负载均衡和反向代理负载均衡
运维·负载均衡
小李小李快乐不已40 分钟前
3.3.2 应用层协议设计protobuf(二进制序列化协议)
linux·c++·后端·网络协议·信息与通信
唐青枫2 小时前
Linux touch 命令详解
linux
熙曦Sakura5 小时前
【Linux】基础开发工具
linux·运维·服务器
小南家的青蛙9 小时前
Linux的网络配置的资料
linux·运维·网络
HinsCoder10 小时前
使用SSH解决在IDEA中Push出现403的问题
运维·笔记·git·ssh·github·intellij-idea
迷雾骑士10 小时前
CentOS Stream release 9安装 MySQL(一)
linux·mysql·centos
良许Linux10 小时前
国内有哪些嵌入式公司?
linux
良许Linux10 小时前
为什么学完了 C 语言觉得自己什么都干不了?
linux