Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: BUG: cd '' doesn't produce an error

Ulrik Haugen wrote:
> If I try
> % cd /tmp; CDPATH=/usr cd ''
> I still wind up in /tmp, so it doesn't seem to have that much to do
> with cdpath to me.

That's because of the special handling of ".": if it doesn't occur in
cdpath, it's assumed to occur first.

That's long-standing behaviour, although I think the documentation (for
cd) is a bit screwy...

          Otherwise [if the argument is not -], if a directory named arg
          is not found in the current directory and arg does not begin
          with a slash, search each component of the  shell  parameter

This isn't actually quite right, since if . is in $cdpath but not at
the start it doesn't search . straight away.  So at least the
description needs improving (this isn't special to a null string).

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

Your mail client is unable to display the latest news from CSR. To access our news copy this link into a web browser:  http://www.csr.com/email_sig.html

Messages sorted by: Reverse Date, Date, Thread, Author