如何通过选项确保变量不为空-z
?
errorstatus="notnull"
if [ !-z $errorstatus ]
then
echo "string is not null"
fi
Run Code Online (Sandbox Code Playgroud)
它返回错误:
./test: line 2: [: !-z: unary operator expected
Run Code Online (Sandbox Code Playgroud) shell ×1