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