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

后端 未结 30 2421
眼角桃花
眼角桃花 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条回答
  •  旧时难觅i
    2020-11-21 06:32

    You can combine Adam & Greg's alias and dot approaches to make something that can be more dynamic—

    alias project=". project"
    

    Now running the project alias will execute the project script in the current shell as opposed to the subshell.

提交回复
热议问题