I use pushd to work with multiple directories in bash and zsh. I've aliased dirs to dirs -v so that I get an ordered list when I want to see what's on the directory stack:
chb$ dirs
0 /Volumes/banister/grosste_daever_gh/2013-03-27/reader
1 /tmp/20130618202713/Library/Internet Plug-Ins
2 ~/code/foo/view/static/css
3 ~/Downloads
Is there a way (either in bash or zsh) that I can refer to one of the directories listed on the command line using an alias for its position on the stack? For example, instead of typing:
chb$ cp ~/code/foo/view/static/css/baz.css ~/code/bar/view/static/css/
I'd type:
chb$ cp <2>baz.css ~/code/bar/view/static/css/
...or something like that, maybe using a dollar sign and a variable name instead of <n>.