Sunday 25 October 2015

How To: Automatically cd to a directory after you create it



The majority of the times that I create a directory I would then change to that directory. To make this happen automatically I add the following to my .bashrc :

mkcd () { mkdir -p "$@" && eval cd "\"\$$#\""; }

Example :

$ mkcd ~/tmp/FOO
$ pwd
/home/cw/tmp/FOO

No comments:

Post a Comment