From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh User <zsh-users@sunsite.dk>
Subject: Re: cd - and $OLDPWD, bug in the manual?
Date: Sat, 25 Mar 2006 23:36:43 -0800 [thread overview]
Message-ID: <060325233643.ZM6802@torch.brasslantern.com> (raw)
In-Reply-To: <20060323210833.GA2891@let.rug.nl>
On Mar 23, 10:08pm, Francisco Borges wrote:
}
} Do you guys agree with me that either the manual or
} Src/builtin.c:cd_get_dest need to change?
To cut right to the chase ... no.
} Sometimes (but not all the time) I want to login and go immediately to
} the last dir I was before logging out. Which I could do using "% cd -1",
} but lazy as I am, I tried to do
}
} % cd -
}
} and this failed... I checked the manual and it says:
}
} cd [ -sLP ] {+|-}n
}
} [...] specified. If arg is `-', change to the value of $OLDPWD, the
} previous directory.
The manual also says (note "Set" not "Used" here):
Parameters Set By The Shell
OLDPWD
The previous working directory. This is set when the shell
initializes and whenever the directory changes.
And in fact "cd -" DOES change to the value of OLDPWD *that was set by
the shell when it initialized*. It just happens that initially PWD and
OLDPWD are set to the same thing, because there has been no "cd" yet.
} I tried setting OLDPWD, but "% cd -" would still not work.
The manual DOESN'T say that you can have any useful effect by assigning
OLDPWD. You can assign to PWD as well, but that doesn't cause a "cd"
to magically occur.
The doc for "cd" could be marginally clearer if it said e.g. ...
If arg is `-', change to the previous directory, normally the value
of $OLDPWD.
... but would that have helped you?
next prev parent reply other threads:[~2006-03-26 7:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-23 21:08 Francisco Borges
2006-03-26 7:36 ` Bart Schaefer [this message]
2006-03-26 17:07 ` [zsh] " Francisco Borges
2006-03-26 18:40 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=060325233643.ZM6802@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).