m*k
2 楼
【 以下文字转载自 Apple 讨论区 】
发信人: madmonk (madmonk), 信区: Apple
标 题: confused by some shell scripts run on mac
发信站: BBS 未名空间站 (Thu Mar 1 20:54:43 2012, 美东)
my.sh file is like this:
#!/bin/bash
while getopts ":a" opt; do
case $opt in
a) echo "-a was triggered!";;
\?) echo "Invalid option: -$OPTARG" ;;
esac
done
but when I ran it several times, I got diff answers:
mymac me$ . my.sh -abc
-a was triggered!
Invalid option: -b
Invalid option: -c
mymac me$ . my.sh -abc
mymac me$ . my.sh -abc
mymac me$
any mac *nix guy can help explain why it behaves like this?
发信人: madmonk (madmonk), 信区: Apple
标 题: confused by some shell scripts run on mac
发信站: BBS 未名空间站 (Thu Mar 1 20:54:43 2012, 美东)
my.sh file is like this:
#!/bin/bash
while getopts ":a" opt; do
case $opt in
a) echo "-a was triggered!";;
\?) echo "Invalid option: -$OPTARG" ;;
esac
done
but when I ran it several times, I got diff answers:
mymac me$ . my.sh -abc
-a was triggered!
Invalid option: -b
Invalid option: -c
mymac me$ . my.sh -abc
mymac me$ . my.sh -abc
mymac me$
any mac *nix guy can help explain why it behaves like this?
a*a
3 楼
PIA黄瓜进行时
P*r
4 楼
我没有啊,我这小农村,物质贫乏啊,只能眼泪汪汪的看着大家吃又脆又多水的中国黄
瓜,我只能望着我的美国黄瓜苗暗自伤神啊
瓜,我只能望着我的美国黄瓜苗暗自伤神啊
B*8
5 楼
支持!
相关阅读