linux - Centos 6.6 shell script -syntax error near unexpected token -
here shell script code, when used in centos 6.6, got 2 error message....
./script12.bash: line 11: syntax error near unexpected token `$1' ./script12.bash: line 11: `case $1 in'
can me find error?
#! /bin/bash num=0 until [ "$num" -eq 30 ] echo -n "please input number here : " read num if [ "$num" -gt 30 ] ; echo "$num" big , try again. echo elif [ "$num" -eq 30 ] ; echo bingo !! got it. else echo "$num" small , try again. echo fi done
not sure how script contains strange blank characters, hex editor shows ascii code 80 characters, seem confuse bash. when replacing them normal spaces (ascii code 20), following works:
#!/bin/bash num=0 until [ "$num" -eq 30 ] echo -n "please input number here : " read num if [ "$num" -gt 30 ] ; echo "$num" big , try again. echo elif [ "$num" -eq 30 ] ; echo bingo !! got it. else echo "$num" small , try again. echo fi done
Comments
Post a Comment