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

后端 未结 30 2865
眼角桃花
眼角桃花 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:46

    I have to work in tcsh, and I know this is not an elegant solution, but for example, if I had to change folders to a path where one word is different, the whole thing can be done in the alias

    a alias_name 'set a = `pwd`; set b = `echo $a | replace "Trees" "Tests"` ; cd $b'
    

    If the path is always fixed, the just

    a alias_name2 'cd path/you/always/need'
    

    should work In the line above, the new folder path is set

提交回复
热议问题