为什么 bash 在 windows 上说 "No such file or directory"?

Why does bash on windows say "No such file or directory"?

我正在尝试 运行 我的 shell 脚本在 Windows 上使用 bash,但它说没有这样的文件。该文件肯定存在(我从命令行检查过)

# Tried all of these, and they all fail
bash C:/Users/myuser/Testing/my_script.sh
bash /c/Users/myuser/Testing/my_script.sh
bash -c /c/Users/myuser/Testing/my_script.sh
bash C:\Users\myuser\Testing\my_script.sh

我刚刚得到:

/bin/bash: C:/Users/myuser/Testing/my_script.sh: No such file or directory

文件是否存在:

dir C:\myuser\Testing\my_script.sh

Volume in drive C is Windows Volume Serial Number is XXXX-XXXX

Directory of C:\myuser\Testing\my_script.sh

08/15/2019 10:42 AM 7,783 my_script.sh
1 File(s) 7,783 bytes
0 Dir(s) 370,855,380,416 bytes free

Bash版本:

bash --version

GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

bash which bash

/bin/bash

使用 Windows 10,运行宁从 cmd shell。

这是一个很难 find/figure 的答案,因为大多数示例显示访问 "C" 驱动器的方式为 /c/Users/myuser 但因为它将 linux 子系统视为 "sort of" 一个不同的 OS,需要安装该驱动器。所以正确的路径是:/mnt/c/Users/myuser/Testing/my_script.sh

bash /mnt/c/Users/myuser/Testing/my_script.sh

关键是开头的/mnt