I want to add another alias to my "aliases" file for the directory I'm currently in (Present Working Directory)

I've tried

printf "alias aaa=cd " + pwd >> myfile

It's close, but I end up getting:

alias aaa=durrantm@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker

instead of:

alias aaa=cd ~/Dropnot/webs/rails_v3/linker/

In other words, my machine-user name are there and I don't want them, I want the pwd at time of execution


Try this instead:

echo "alias aaa='cd \"$PWD\"'" >> ~/.bash_aliases

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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