当我运行程序并单击"is"时会引发错误:
/home/zygis/tools/script: 26: Syntax error: ")" unexpected (expecting ";;")
代码:
DIALOG=${DIALOG=dialog}
$DIALOG --title " My first dialog" --clear \
--yesno "You really want to run this program?" 10 30
case $? in
0)
if [ "$1" = "start" ];
then
echo "Enter OS: ";
read OS
echo OS
python /home/zygis/tools/dj.py $OS
else
if [ "$1" = "uprint" ];
then
echo "usage: {start}";
echo "example: (./boot start)";
else
echo "Invalid choice";
echo "To usage use uprint";
fi
fi
1)
echo "No chosen.";
255)
echo "ESC pressed.";
esac
最佳答案
您的case/esac
的每个案例都必须由;;
终止。 See the man page...
case $? in
0)
if [ "$1" = "start" ];
then
echo "Enter OS: ";
read OS
echo OS
python /home/zygis/tools/dj.py $OS
else
if [ "$1" = "uprint" ];
then
echo "usage: {start}";
echo "example: (./boot start)";
else
echo "Invalid choice";
echo "To usage use uprint";
fi
fi
# Terminate.....
;;
1)
echo "No chosen.";
# Terminate.....
;;
255)
echo "ESC pressed.";
# Terminate.....
;;
esac
关于linux - 小 sh 脚本错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6790746/