if[ "$1"=="hello" ];then
echo "Hello,how are you?"
elif[ "$1"=="" ];then
echo "You MUST input parameters, ex>$0 some word"
else
echo "The only parameter is 'hello'"
fi
这语法有错吗?为什么总是报这样的错误?
sh08.sh: line 9: syntax error near unexpected token `then'
sh08.sh: line 9: `if[ "$1"=="hello" ];then'
...全文
335打赏收藏
shell的问题
if[ "$1"=="hello" ];then echo "Hello,how are you?" elif[ "$1"=="" ];then echo "You MUST input parameters, ex>$0 some word" else echo "The only parameter is 'hello'" fi 这语法有错吗?为什么总是报这样的错误? sh08.sh: line 9: syntax error near unexpected token `then' sh0
#!/bin/sh
if [ "$1" == "hello" ];then
echo "Hello,how are you?"
elif [ "$1" == "" ];then
echo "You MUST input parameters, ex>$0 some word"
else
echo "The only parameter is 'hello'"
fi