0
我想要做的就是給用戶一個選項,鍵入要刪除的文件「Y」或「N」UNIX要求用戶輸入「Y」或「N」
不過,我不斷收到錯誤:
line 38: syntax error near unexpected token `)'
line 38: v) $verbose = true ;
(我有一個變量命名冗長,它是等於假)
我的代碼如下:
while getopts :iv opt
do
case $opt in
i) read -p "remove ? " opt
case $opt in
y|Y)
$interactive = true
echo "YOU HAVE DELETED THIS FILE"
sendToBin ;;
n|N)
echo "YOU HAVE CHOSEN NOT TO DELETE THIS FILE"
exit ;;
esac
v) $verbose = true
echo "YOU HAVE CHOSEN VERBOSE" ;;
\?)echo "WHAT ARE YOU CRAZY"
exit ;;
esac
done
shift $(($OPTIND - 1))
任何想法?
的'$'是他們是如何訪問。 – squiguy