bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

why does cd change DIRSTACK?


From: Micha Wiedenmann
Subject: why does cd change DIRSTACK?
Date: Sun, 10 Feb 2008 20:53:19 +0100
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]