我想检查用户是否给了脚本任何参数,如果是这种情况,脚本应该关闭。
if [ $@ = "" ]; then exit fi
不管用。
你可以这样尝试,
if [ "$#" -eq 0 ]; then echo "Illegal number of parameters" fi