linux里while [-n "$1"]这里的-n是什么意思?
答案:2 悬赏:60 手机版
解决时间 2021-04-04 11:17
- 提问者网友:自食苦果
- 2021-04-03 18:55
linux里while [-n "$1"]这里的-n是什么意思?
最佳答案
- 五星知识达人网友:酒醒三更
- 2021-04-03 19:34
-n str,字符串不为null,长度大于零
全部回答
- 1楼网友:笑迎怀羞
- 2021-04-03 20:40
"$1" string is not null (contains one or more characters)
#//=== example ===//#
if [ -n $string1 ] # string1 has not been declared or initialized.
then
echo "String \"string1\" is not null."
else
echo "String \"string1\" is null."
fi # Wrong result.
# Shows $string1 as not null, although it was not initialized.
#//=== example ===//#
if [ -n $string1 ] # string1 has not been declared or initialized.
then
echo "String \"string1\" is not null."
else
echo "String \"string1\" is null."
fi # Wrong result.
# Shows $string1 as not null, although it was not initialized.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯