Why I can't change directories using “cd”?

后端 未结 30 2931
眼角桃花
眼角桃花 2020-11-21 06:17

I\'m trying to write a small script to change the current directory to my project directory:

#!/bin/bash
cd /home/tree/projects/java

I save

30条回答
  •  执笔经年
    2020-11-21 06:33

    It only changes the directory for the script itself, while your current directory stays the same.

    You might want to use a symbolic link instead. It allows you to make a "shortcut" to a file or directory, so you'd only have to type something like cd my-project.

提交回复
热议问题