I “grew up” with tcsh, but have lately switched to bash because it’s ubiquitous in the linux world (and I can’t be bothered trying to get tcsh installed on all the servers I use).
For almost a year I thought bash was without directory stack expansion: I’d read the directory stack section in various tutorials and docs, but all they mentioned were pushd, popd and dirs. I’d asked various long-time (albeit casual) bash users, and none knew about it. And my attempts at asking the search engines were not met with success (which was my inability to articulate what I wanted*, rather than the information not being available).
This frustrated me, almost to the point of my switching back to tcsh (or try another alternative).
…until I stumbled on the answer: tilde.
~N
The string that would be displayed by dirs +N
~+N
The string that would be displayed by dirs +N
~-N
The string that would be displayed by dirs -N
E.g.,
$ cd /etc/postgresql/8.3/
$ pushd ~/backup/
$ cp ~1/main/pg_hba.conf .
On the topic, I recommend the following aliases:
alias dirs=’dirs -v’
alias pd=’pushd’
alias po=’popd’
* I was searching for “bash counterpart to tcsh’s equals” or “complete directory stack items in bash” or “bash vs tcsh directory stack”