zsh-workers
 help / color / mirror / code / Atom feed
* How to use popd?
@ 2007-12-19  0:13 Jörg Sommer
  2007-12-19  9:59 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Jörg Sommer @ 2007-12-19  0:13 UTC (permalink / raw)
  To: zsh-workers

Hi,

I've this situation:
% dirs
/usr ~ /tmp ~/Tmp/kernel/linux ~
% pwd
/usr

Now I want to go to /tmp. I thought popd +2 is what I need, but I'm still
in /usr. Only the entry for /tmp is removed.

% popd +2
/usr ~ ~/Tmp/kernel/linux ~
% pwd
/usr

Why doesn't popd change the directory?

Bye, Jörg.
-- 
Du kannst einem Schwein einen goldenen Ring durch die Nase ziehen,
deswegen bleibt es trozdem ein Schwein!


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to use popd?
  2007-12-19  0:13 How to use popd? Jörg Sommer
@ 2007-12-19  9:59 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2007-12-19  9:59 UTC (permalink / raw)
  To: zsh-workers

On Wed, 19 Dec 2007 00:13:13 +0000 (UTC)
Jörg Sommer <joerg@alea.gnuu.de> wrote:
> I've this situation:
> % dirs
> /usr ~ /tmp ~/Tmp/kernel/linux ~
> % pwd
> /usr
> 
> Now I want to go to /tmp. I thought popd +2 is what I need, but I'm still
> in /usr.

This is documented in the manual.  "popd +2" pulls the second item after
the head from the stack then changes to the new top.  The new top is still
/usr.

If you are trying to remove /usr and ~ from the stack completely
use "repeat 2 popd".  If you do this a lot, try

  rpopd() { repeat $1 popd; }

If you're just trying to bring /tmp to the head you need "pushd +2".

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-19 10:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-19  0:13 How to use popd? Jörg Sommer
2007-12-19  9:59 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).