FROM_PROJECT=false
if [[ -z $INV_NAME ]]; then
if [[ -z $PRO_NAME ]]; then
echo "error: variable not set" >&2
exit 1
elif [[ -z $INV_FILE ]]; then
echo "error: variable INV not set" >&2
exit 1
fi
FROM_PRO=true
elif [[ -n $PRO_NAME ]] || [[ -n $INV_FILE ]]; then
echo "error: variable INV_NAME is not compatible with PRO_NAME and INVENTORY_FILE" >&2
exit 1
我不确定这些" -z"和" -n"在这做什么?
答案 0 :(得分:2)
-z
用于测试字符串是否为空。
-n
恰恰相反。