foo.sh
我的 Cygwin 目录中有脚本/usr/local/bin
。我可以使用 bash 运行它mintty
,但不能使用 bash。
当我开始时,情况如下:
foo.sh in mintty - WORKING
foo.sh in bash - NOT WORKING
然后我export PATH="${PATH}:/usr/local/bin"
在我的.bashrc
文件中添加了行。现在情况如下:
foo.sh in mintty - WORKING
foo.sh in bash - WORKING
however
bash -c foo.sh - NOT WORKING
我需要运行脚本的最后一种方法才能工作。我将在为 Windows 编译的可执行文件中使用它,因此该命令必须在cmd
.
我的问题是:
- 如何设置变量
PATH
,使用bash -c
。 - 为什么默认
/usr/local/bin
不进去?PATH
有什么理由不做我想做的事吗?