我在为Cydia制作的bash脚本上收到了这个错误。但是我的文件以76结尾。
这是我的第一个实际脚本,所以我只是搞乱,但想知道错误。
谢谢!
P.S:我在Ubuntu 13.10中使用gedit进行编码
<击> http://pastebin.com/pj4pBDwB 击>
#!/bin/bash
#Say Hello
#Check if they need help
if [ "$1" == "--help" ]; then
echo
echo "Usage: copycat <message>"
echo " --exit | Exit the script."
echo "CopyCat is a very simple script I have made for "
echo "practice & entertainment."
echo
exit 0
else
echo "===============/\===============/\==============="
echo "Hey, "$USER". I'm CopyCat! :) I have a tendency of "
echo "copying people..."
echo "Remember, at any time you can exit the script by "
echo "typing copycat --exit"
echo
fi
#Teaser
function tease(){
i=0
sleep 0.2
case "$i" in
'0')
echo "Teehee"
i=`expr $i + 1`
;;
'1')
echo "Your smart"
i=`expr $i + 1`
;;
'2')
echo "LOL Fool"
i=`expr $i + 1`
;;
'3')
echo "Isn't this getting old?"
i=`expr $i + 1`
;;
'4')
echo "Outta show off your brains, here!"
i=0
esac
}
#Copy them
RUN=true
i=0
echo "CopyCat: Let's Chat!"
read ans
if [ "$ans" != "--exit" ]; then
while [ RUN=true ]; do
i= `expr $i + 1`
read ans
sleep 0.5
echo "CopyCat: "$ans""
tease
echo
if [ $i -e 4 ]; then
echo "CopyCat: I am tired.. I am going to take a break..."
exit 0
fi
done
else
RUN=false
echo "CopyCat: Oh.. But we were having so much fun!"
exit 0
exit 0
答案 0 :(得分:2)
您没有fi
与第57行的if
相匹配。
正确缩进代码可以更容易地找到这样的错误。
(顺便说一句,在/usr/bin
中安装实验性脚本可能不是一个好主意,这是用于系统二进制文件。安装在$PATH
的其他目录中,也许是$HOME/bin
- 或者只需将它们放在当前目录中,然后键入./script-name
即可运行它们。)