我想要做的是给用户一个选项,通过键入“y”或“n”来删除文件
但是我不断收到错误消息:
第 38 行:意外标记 `)' 附近的语法错误
第 38 行:v) $verbose = true ;
(我有一个名为 verbose 的变量,它等于 false )
我的代码如下:
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))
有任何想法吗?