windows 如何在 bash 脚本中访问 /cygdrive/c/..?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6477198/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:11:25  来源:igfitidea点击:

How do I access /cygdrive/c/.. in a bash script?

windowsbashcygwin

提问by Kelbizzle

Why can't the folder be found? I double checked that it exists.

为什么找不到文件夹?我仔细检查了它是否存在。

#!/bin/bash
echo "This will sync the background_docs folder"
lftp ftp://user:[email protected] -e "mirror -r /cygdrive/c/Users/usera/Desktop/test_folder/ --only-missing -e;exit"

采纳答案by Kelbizzle

Could that be your problem: "mirror - Mirror specified source directory to local target directory" If I read that correctly then you are looking for the /cygdrive/c/.... dir on the FTP server which probably does not have a cygwin-based FTP server. Try -R if you want to put files to the server, or write "mirror -r server-dir /cygdrive/c/..." – HelmuthB

这可能是您的问题:“镜像 - 将指定的源目录镜像到本地目标目录”如果我没看错,那么您正在寻找可能没有 cygwin 的 FTP 服务器上的 /cygdrive/c/.... dir基于FTP服务器。如果要将文件放入服务器,请尝试 -R,或者编写“mirror -r server-dir /cygdrive/c/...” – HelmuthB

回答by sehe

I suggest looking at cygpath

我建议看看 cygpath

cygpath -w

cygpath -w

converts to windows path

cygpath -u

cygpath -u

converts to unix path