为什么不能用getopts函数关闭我的电脑?
问题描述:
已验证sudo shutdown -P
可以关闭我的电脑。为什么不能用getopts函数关闭我的电脑?
test(){
while getopts "s" arg
do
case $arg in
s)
sudo shutdown -P
;;
esac
done
}
为什么test -s
无法关机我的电脑?
已验证sudo shutdown -P
可以关闭我的电脑。为什么不能用getopts函数关闭我的电脑?
test(){
while getopts "s" arg
do
case $arg in
s)
sudo shutdown -P
;;
esac
done
}
为什么test -s
无法关机我的电脑?