我将其作为bash脚本的一部分
{
read -n1 -p "Do you want to download some tv programmes? [y/n/q] " ynq ;
[Yy] read -n200 -p "Please input the tv programme numbers to download " 'tvbox';
echo; cd /media/$USER/back2/proggies/; /usr/bin/get-iplayer --get $tvbox;
[Nn]* ) echo;; # moves on to next question in the script
[Qq]* ) echo; exit;; # quits
* ) echo "Thank you ";;
esac
};
但由于语法错误而无法工作。我该如何提出两个问题,如果您回答第一个问题,则仅出现第二个问题,然后解决了语法错误,请脚本有效?谢谢。
case
语句的开始似乎是畸形的。
{
read -n1 -p "Do you want to download some tv programmes? [y/n/q] " ynq
case $ynq in
[Yy]) read -n200 -p "Please input the tv programme numbers to download " 'tvbox'
echo
cd /media/$USER/back2/proggies/
/usr/bin/get-iplayer --get $tvbox
;;
[Nn]* ) echo;; # moves on to next question in the script
[Qq]* ) echo; exit;; # quits
* ) echo "Thank you ";;
esac
};