在windows中更改bash脚本中的目录
如何在windows中更改bash脚本中的工作目录。我有 ~dp0=C:\test\docker\windows,我想将我的目录更改为C:\test\build 所以它意味着向上2级,然后INTO构建文件夹在windows中更改bash脚本中的目录,windows,bash,path,cd,Windows,Bash,Path,Cd,如何在windows中更改bash脚本中的工作目录。我有 ~dp0=C:\test\docker\windows,我想将我的目录更改为C:\test\build 所以它意味着向上2级,然后INTO构建文件夹 感谢使用bash脚本更改目录,就像使用普通bash一样 cd "C:/test/build" echo "You're now in the folder, do what you will." 将文件另存为.sh,这样就可以使用它。 注意,当使用bash脚本导航文件夹时,请记住您将从的目
感谢使用bash脚本更改目录,就像使用普通bash一样
cd "C:/test/build"
echo "You're now in the folder, do what you will."
将文件另存为.sh,这样就可以使用它。
注意,当使用bash脚本导航文件夹时,请记住您将从的目录始终是主目录。因为默认情况下C:\已装入/mnt/C,所以这将起作用。
通过以下命令在主路径中创建.bashrc:
echo "BUILDDIR=/mnt/c/test/build" >> ~/.bashrc;source ~/.bashrc
cd $BUILDDIR
# Do your work below for example ./configure.
./configure
在我的Git bash系统上,C:\root只是
/C/
,其他目录都是,所以它应该是cd/C/test/build/
您还可以说cd.././build/
祝你好运