Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: directory alias
On Tue, Dec 03, 2013 at 10:21:53PM -0500, shawn wilson wrote:
> What I want is a way to do:
> cd foo
> and it go to ~/some/deep/directory/tree/foo
> and
> cd bar
> and it go to /usr/local/some/path/bar
>
> Is there some zsh-ism (or better bash-ism that also works in zsh so
> that this works on systems I maintain without zsh) to do this without
> symlinks?
Named directories.
$ hash -d foo=~/some/deep/directory/tree/foo
$ hash -d bar=/usr/local/some/path/bar
cd ~foo
cd ~bar
Personally I prefer aliases like
alias cfoo "cd ~/some/deep/directory/tree/foo"
as I don't like to have the shortcuts for manually named dirs in
the prompt. And actually finding these cd commands from the
history works automatically without having to define aliases or
hash table entries manually.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
Messages sorted by:
Reverse Date,
Date,
Thread,
Author