Hi,
I don't understand why cd changes DIRSTACK. From the manpage I got the
impression that only pushd and popd change DIRSTACK (besides dir -c).
Assume I want to cycle some favorite directories (/usr, /var, /etc). I
thought I had to add them via pushd and could use cd ~N; to switch
easily between them but that doesn't work.
~$ pushd /var; pushd /etc; pushd /usr;
/usr$ dirs
/usr /etc /var ~
/usr$ cd ~2
/var$ dirs
/var /etc /var ~
In my opinion /usr is missing in the 2nd output of dirs.
If pushd would remove duplicate entries then I could do
(as described in
<http://www.softpanorama.org/Scripting/Shellorama/pushd_and_popd.shtml>)
~$ dirs -c; pushd /var; pushd /etc; pushd /usr;
/usr$ dirs
/usr /etc /var ~
/usr$ pushd ~2
/var /usr /etc /var ~
Additionally I don't understand why the current directory is in the
output of dirs at all. "dirs -c" says it would delete the directory
stack but it doesn't remove the first entry.
Thank you for your consideration,
Micha