如何检查 Bash 中的变量是否为空?
最佳答案
在 Bash 中,至少以下命令测试$var 是否为空:
if [[ -z "$var" ]]; then
# $var is empty, do what you want
fi
命令 man test
是你的 friend 。
关于bash - 如何在 Bash 中查找变量是否为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3061036/