I'm currently using bash on Ubuntu, and I work a lot with a directory saved at /home/me/path/to/project_dir. It is a nuisance to change to the directory every time I open bash. So I'd like to save the path to a variable, say projdir
, so that I can just do cd projdir
. If my working directory changes, I should be able to change the path by overwriting the variable. I want to be able to update the variable easily, preferably with one command, without messing with .bashrc.
One important thing is that this variable should persist even if I restart bash. How do I do this? I'd still like to see my home directory when I start up bash, so changing the default starting directory to project_dir is not an option.
.bashrc
? That is designed for these things!.bashrc
to your advantage, I am sure you will like it once you get use to it! Try to read up on aliases and functions :)