test.sh
#!/bin/bash echo "enter the string:" read filename if test $filename ; then echo "it's not zero" else echo "it's zero" fi
执行
sudo chmod +x test.sh
./test.sh
输出
enter the string: it's zero
执行
./test.sh
输出
enter the string: kk it's not zero