在 MSYS 中,当存在路径分隔符时,`fd --glob` 总是失败
所以,这里是我操作的目录: Pictures/Backgrounds/1.jpg Pictures/Backgrounds/2.jpg Pictures/Backgrounds/3.jpg Pictures/1.jpg 以下是一些结果: λ fd -u -g 'Pictures' Pictures/ λ fd -u -g 'Backgrounds' Pictures/Backgrounds/ λ fd -u -g '1*' Pictures/1.jpg Pictures/Backgrounds/1.jpg λ fd -u -g 'Pictures/1*' (Nothing) λ fd -u -g 'Pictures/1.jpg' (Nothing) λ fd -u -g 'Pictures/Backgrounds' (Nothing) λ fd -u -g 'Pictures/Backgrounds/*' (Nothing) λ fd -u -g 'Pictures/**' (Nothing) λ fd -u -g '*/*' (Nothing) (然后我尝试了上面所有失败的命令,使用了 `\`, `\\` 和 `\/`,结果都一样) 所以,你可以看到,只要有路径分隔符,fd 就永远不会返回任何东西。在使用 `--full-path` 时,无论是否带有 `**/` 前缀,都会出现同样的情况。 编辑:好吧,我发现我遗漏了一些信息。虽然我在 MSYS 中运行,但 fd 可执行文件是通过 scoop.sh 提供的 Windows 版本,我认为这是 msvc 版本。因此,我尝试在 Windows PowerShell 中运行,找到了完全相同的结果,然后在 Windows CMD 中尝试,glob 选项根本不起作用(这可能是一个单独的问题)。我还下载并测试了 gnu 版本,结果也是一样。
内容来源: sharkdp/fd