简体   繁体   English

使用 Windows 终端的 Cygwin 起始目录

[英]Cygwin starting directory using Windows Terminal

The guide at https://github.com/microsoft/terminal/blob/master/doc/user-docs/ThirdPartyToolProfiles.md suggests to use https://github.com/microsoft/terminal/blob/master/doc/user-docs/ThirdPartyToolProfiles.md的指南建议使用

{
    "name" : "Cygwin",
    "commandline" : "C:/Cygwin/bin/bash --login -i",
    "icon" : "C:/Cygwin/Cygwin.ico",
    "startingDirectory" : "C:/Cygwin/bin"
}

However, I'd like the startingDirectory to be $USERPROFILE .但是,我希望startingDirectory$USERPROFILE I have attempted various different methods to change the starting directory but they have all failed.我尝试了各种不同的方法来更改起始目录,但都失败了。

The trick is to use the chere package in Cygwin, which is used to solve the same problem.诀窍是在 Cygwin 中使用chere package,它用于解决相同的问题。 First ensure chere is installed in Cygwin.首先确保chere安装在 Cygwin 中。 Then modify the commandline to the following:然后修改commandline如下:

                "name": "Cygwin",
                "commandline": "c:\\cygwin\\bin\\bash.exe /bin/xhere /bin/bash",
                "startingDirectory" : "%USERPROFILE%"

After this, you can change startingDirectory to any path.在此之后,您可以将startingDirectory更改为任何路径。

Note, for those that are annoyed by the starting /bin/bash that is printed after launching Cygwin using this command you can simply comment out that line in /bin/xhere using the following sed one-liner sed -i -e 's|^\s*echo Starting $1;|# \0|' /bin/xhere请注意,对于那些对使用此命令启动 Cygwin 后打印的starting /bin/bash感到恼火的人,您可以使用以下 sed 单行sed -i -e 's|^\s*echo Starting $1;|# \0|' /bin/xhere/bin/xhere中简单地注释掉该行sed -i -e 's|^\s*echo Starting $1;|# \0|' /bin/xhere sed -i -e 's|^\s*echo Starting $1;|# \0|' /bin/xhere

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM