在windows上更改目录的简单Git Bash.sh脚本不起作用..sh脚本中的基本更改目录



试图制作一个脚本来自动激活我的django项目的虚拟环境。这是我的脚本,我保存为"activatevirt.sh"。前几行有效,但随后当它到达更改目录的行时,它不会更改目录。有人能给我实现这个的确切代码吗?我在这里读到了一些答案让我感到困惑,没有帮助。如果有人能简单地给我确切的代码会给我一个脚本,它会更改gitbash for windows中的目录杰出的谢谢

''

#!/bin/bash
python -m venv virt
echo testing and this line works too.
cd virt #this line doesn't work!
cd scripts # this line doesn't work either!
source activate # this line might work if it were in the right directory... not sure yet!
whoami 

''

cd virtcd scripts都使用相对路径定义,在不期望的情况下,该定义可能会失败;当前";目录

检测到/some/path/to/virt/scripts的完全绝对路径并使用它

最新更新