Hacker News new | ask | show | jobs
by coenhyde 5595 days ago
I use this function in my bash profile to navigate to my projects from anywhere on the file system.

  function to {
    cd ~/Sites/$1/
  }
eg. cd ~/Sites/coenhyde.com

$ to coenhyde.com

1 comments

I would suggest mapping an alias instead of creating a function so that you will still be able to take advantage of parameter completion:

> alias to='cd ~/Sites/'

Ah, much nicer. Thankyou.

Edit: On testing it doesn't work. 'to sitename' just goes straight to ~/Sites/. I knew there must have been a reason i used a function instead of an alias.

Oh, that's right. 'to sitename' becomes 'cd ~/Sites/ sitename' which is not what you want. My apologies.