我正在看下面的代码:
if [ -z $2 ]; then
echo "usage: ...
Run Code Online (Sandbox Code Playgroud)
(3个点是不相关的使用细节.)
也许我在谷歌搜索错误,但我找不到该-z选项的解释.
Yu *_*Hao 339
-z string 如果字符串为null(空字符串),则为True
小智 48
-z
string is null, that is, has zero length
String='' # Zero-length ("null") string variable.
if [ -z "$String" ]
then
echo "\$String is null."
else
echo "\$String is NOT null."
fi # $String is null.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
175119 次 |
| 最近记录: |