test.sh

#!/bin/bash
s1=""
if test $s1 ;then
echo "length is not zero"
else
echo "the length is 0"
fi
s2="shell"
if test $s2 ;then
echo "length is not 0"
else
echo "the length is 0"
fi

执行

sudo chmod +x test.sh
./test.sh

输出

the length is 0
length is not 0

 

相关文章:

  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2021-06-11
  • 2021-12-04
  • 2021-12-04
  • 2021-06-21
  • 2021-08-17
猜你喜欢
  • 2022-02-20
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-12-04
相关资源
相似解决方案