我正在查看 Google 的 bash 脚本样式指南,发现他们引用了退出状态变量$? 在这里。
if [[ "$?" -ne 0 ]]; then error_message fi
我认为返回值总是数字,所以有什么理由引用它们吗?
进入只是一个好习惯(因为你想引用其他特殊的shell变量,比如“$@”)?
shell bash quoting
bash ×1
quoting ×1
shell ×1