Open ShixiangWang opened 3 years ago
shcheck
( set -o posix ; set ) >/tmp/variables.before
source script
( set -o posix ; set ) >/tmp/variables.after
diff /tmp/variables.before /tmp/variables.after
rm /tmp/variables.before /tmp/variables.after
https://stackoverflow.com/questions/1305237/how-to-list-variables-declared-in-script-in-bash
zsh
( setopt posixbuiltin; set; )
https://askubuntu.com/questions/275965/how-to-list-all-variables-names-and-their-current-values
对每个输入的shell脚本检查变量并逐一输出值,另外进行空值检查和提示