由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Apple版 - confused by some shell scripts run on mac
相关主题
中毒了?retina text 发毛 见图
Re: 苹果机里有没有象Editplus或者notepad一样的软件?请问MAC上哪个文本编辑器有notepad++的一个功能? (转载)
Snow Leopard鲜为人知的改进列表求教:OSX有一点用起来很不爽
用mac的同学请教一下 (转载)Setting up Mountain Lion: 12 geek setup tips
MAC 下 命令行下,直接调用TEXTEDIT的命令是啥?或者有哪个自带的文本编辑器好用?多谢!OS X上有没有轻量级的TextEdit软件?能语法高亮
有的网上下载的TXT中文文档用MAC打开是乱码.一般大家怎么转换.USPTO invalidates all claims of 'Steve Jobs' multi-touch patent zz
imac 里的 textedit 不见了 (OS X 10.5.8 )无缘无故的消失了linux下的可执行文件能否有办法在mac雪豹下运行?
Inside Mac OS X 10.7 Lion: TextEdit adds vertical layout, graphical toolbarmitbbs app sucks!!!!!
相关话题的讨论汇总
话题: mymac话题: invalid话题: bash话题: abc话题: me
进入Apple版参与讨论
1 (共1页)
m*****k
发帖数: 731
1
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?
n*******s
发帖数: 149
2
dont have a max os.
but looks like you should run "./my.sh -abc" instead of ". my.sh -abc". In
case my.sh is not executable, run "chmod +x my.sh" to make it executable.
. is a command, similar to source command.

【在 m*****k 的大作中提到】
: 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

m*****k
发帖数: 731
3
it is 777, ./my.sh not work, gave error like
-bash: ./my.sh: /bin/bash: bad interpreter: Operation not permitted
I guess I need reset PATH
w*******x
发帖数: 489
4
Does the command >which bash
gives you /bin/bash
?

【在 m*****k 的大作中提到】
: it is 777, ./my.sh not work, gave error like
: -bash: ./my.sh: /bin/bash: bad interpreter: Operation not permitted
: I guess I need reset PATH

m*****k
发帖数: 731
5
yes,it gave the right bash, I found out the reason, I had used textedit to
change and save the sh, then ls -al shows that the sh is rwxrwxrwx@, the
strange @ added by textedit caused this error. use nano to edit a same
content sh, everything worked.
1 (共1页)
进入Apple版参与讨论
相关主题
mitbbs app sucks!!!!!MAC 下 命令行下,直接调用TEXTEDIT的命令是啥?或者有哪个自带的文本编辑器好用?多谢!
Macbook Pro 为什么鼠标和触摸键盘都没在用但光标一直水平方向跳动?有的网上下载的TXT中文文档用MAC打开是乱码.一般大家怎么转换.
iphone 4s 自动关机imac 里的 textedit 不见了 (OS X 10.5.8 )无缘无故的消失了
讨论注意措辞。。。谢谢。。。Inside Mac OS X 10.7 Lion: TextEdit adds vertical layout, graphical toolbar
中毒了?retina text 发毛 见图
Re: 苹果机里有没有象Editplus或者notepad一样的软件?请问MAC上哪个文本编辑器有notepad++的一个功能? (转载)
Snow Leopard鲜为人知的改进列表求教:OSX有一点用起来很不爽
用mac的同学请教一下 (转载)Setting up Mountain Lion: 12 geek setup tips
相关话题的讨论汇总
话题: mymac话题: invalid话题: bash话题: abc话题: me