Reputation: 2100
I have a symbolic link('cur_project') in my HOME directory and want to change its destination every time i start working on any new project by just calling the SET_CUR_PROJ variable on terminal.
I've added a line in ~/.vimrc file like this:
SET_CUR_PROJ= "ln -sf -T $PWD $HOME/cur_project"
By this line i mean that whenever i call this variable it should change that symbolic to current working directory. I am running this command as :
$source ~/.bashrc
$$SET_CUR_PROJ
Problem with this approach is it resolves the two variables $PWD and $HOME at the time of source but i need to resolve $PWD into its recent values.
Upvotes: 0
Views: 3184
Reputation: 246807
variables don't work like that. What you want is a function:
function SET_CUR_PROJ {
ln -sf -T $PWD $HOME/cur_project
}
Then you invoke it with SET_CUR_PROJ
Upvotes: 2