How do you change the HOME path so that is set globally?

I like to change my HOME path to the base directory of the current project I am working on for that session, and make heavy use of opening and closing tabs, along with the cd command. Currently, every time I open up a new tab, I have to reset the HOME path to the base directory of the project I am working on. I am looking for a sort of permanent change just for that session while I am working. I can deal with having to change it back to my actual home directory at the end of work sessions if need be.

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

Started as an interactive shell, as when you open a tab, bash reads ~/.bash_profile. So have this rcfile cd into the directly you're focused on. You might do this with a 'focus' command:

#! /bin/bash
# usage: focus             # new bash cd's harmlessly to $HOME
# usage: focus /some/dir   # new bash cd's to /some/dir
echo "cd $1" > ~/.focus_dir

, with . ~/.focus_dir as the last line of ~/.bash_profile.

link|improve this answer
Do I have to add the focus_dir file to every project directory? – Corey Hart Oct 9 '09 at 4:17
Also, I'm working with a bashrc file, does that make a difference? – Corey Hart Oct 9 '09 at 4:19
The file is named ~/.focus_dir -- i.e., a'.focus_dir' in your home directory. Do not place this in ~/.bashrc , but place it in a new ~/.bash_profile . Please see Bash Startup Files and Tilde Expansion. – ayrnieu Oct 9 '09 at 4:50
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.