如何在 Mac OS X Snow Leopard 上运行 bash 脚本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12224621/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to run a bash script on Mac OS X Snow Leopard?
提问by Stephen
All my bash scripts don't seem to run on Mac OS X Snow Leopard. I created a dummy bash shell script (dummy.sh). The script's permissions are
我所有的 bash 脚本似乎都不能在 Mac OS X Snow Leopard 上运行。我创建了一个虚拟的 bash shell 脚本 (dummy.sh)。脚本的权限是
-rwxr-xr-x@
The script has these lines:
该脚本有以下几行:
#!/bin/bash
echo
My $PATH is
我的 $PATH 是
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
However, every time I try to run dummy.sh in my terminal, I get this error:
但是,每次我尝试在终端中运行 dummy.sh 时,都会收到此错误:
-bash: dummy.sh: command not found
bash is confirmed to be in /bin
bash 被确认在 /bin
Can somebody help me to determine why I can't run shell scripts I create?
有人可以帮我确定为什么我不能运行我创建的 shell 脚本吗?
采纳答案by tchrist
You don't have '.' in your path, and are not calling it with an explicit path.
你没有'.' 在您的路径中,并且没有使用显式路径调用它。

