中国Linux公社论坛's Archiver

angelppp2008 发表于 2009-8-5 15:43

新手提问 shell scripts

if  [ "$1"=="hellp" ];then
echo "Hello! How are you?"
elif [ "$1"=="" ];then
echo "You must input paramenters"
else
echo "The only accept parameter is hello"
fi

无论现在输什么都是 Hello!How are you? 这是怎么回事?! 谢谢!!

mimimomu 发表于 2011-12-26 15:38

少了空格:
if  [ "$1" == "hellp" ];then
echo "Hello! How are you?"
elif [ "$1" == "" ];then
echo "You must input paramenters"
else
echo "The only accept parameter is hello"
fi

页: [1]

Powered by Discuz! Archiver 6.1.0F  © 2001-2007 Comsenz Inc.