我是新手,请问大侠这个是错在哪??
#bash
if [ "$1" = "cm" ]
then
echo "ok"
fi
exit 0
linux-6lod:/home/yq # ./start.sh "cm"
./start.sh: line 7: syntax error: unexpected end of file
linux-6lod:/home/yq # ./start.sh cm
./start.sh: line 7: syntax error: unexpected end of file
linux-6lod:/home/yq #
[解决办法]
你的脚步里有汉字字符 或者windows下的字符
/bin/bash^M
从这句就能看出来
把下面的代码直接复制到你的linux里去
#!/bin/bashif [ "$1" = "cm" ]then echo "ok"fiexit 0
[解决办法]
你这样试试dos2unix start.sh
然后再执行./start.sh cm
[解决办法]