gpt4 book ai didi

linux - 小 sh 脚本错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:54:05 24 4
gpt4 key购买 nike

当我运行程序并单击"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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com