我在尝试运行它时不断在bash脚本中遇到以下错误,我似乎找不到问题。我认为这与我如何关闭循环有关。任何帮助将不胜感激
bash: random: line 66: syntax error: unexpected end of file
以下是我的代码
#!/bin/bash
one=$RANDOM
two=$RANDOM
# Declare variable choice and assign value 4
choice=5
# Print to stdout
echo "1. -l"
echo "2. -m"
echo "3. -c"
echo "4. -i"
echo -n "Please choose a word [1,2,3,4]? "
while [ $choice -eq 5 ]; do
#option -l
if [ $choice -eq 1 ] ; then
#do something
else
echo "Please make a choice between 1 -4 !"
echo "1.-l"
echo "2.-m"
echo "3.-c"
echo "4.-i"
echo -n "Please choose a word [1,2,3 or 4]? "
choice=5
fi
echo"finished"
done
编辑*删除了大量代码,因为它引起了缩进问题。
您尚未为您的wier循环完成done
:
while [ $choice -eq 5 ]; do
...lots of stuff ...
done <---you're missing this