【发布时间】:2019-01-27 16:28:36
【问题描述】:
Git for windows 安装 bash,bash.exe 可从 windows 命令提示符处获取。
启动 bash 脚本失败:
bash.exe D:\path\to\script.sh
/bin/bash: D:\path\to\script.sh: No such file or directory
但该文件存在:
type D:\path\to\script.sh
<<< output >>>
正斜杠也不起作用:
bash.exe /d/path/to/script.sh
管道也不行:
echo '/d/path/to/script.sh' | bash.exe
打字
cat /d/path/to/script.sh
但是,在 bash.exe 中有效。
/编辑: 设备名称的大写似乎没有任何改变。 和
bash.exe \\d\\path\\to\\script.sh
也不行。
【问题讨论】:
-
只是猜测,试试
bash.exe d:/path/to/script.sh -
/d是 bash 语法糖,windows 不知道 -
bash -c "source /d/path/to/script.sh"值得考虑。