autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] docs: mention cd limitation


From: Paolo Bonzini
Subject: Re: [PATCH 1/2] docs: mention cd limitation
Date: Sat, 31 Jul 2010 18:29:07 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5

On 07/31/2010 06:27 PM, Eric Blake wrote:
On 07/31/2010 03:24 AM, Paolo Bonzini wrote:
On 07/30/2010 12:24 AM, Eric Blake wrote:
+Posix states that behavior is undefined if @command{cd} is given an
+explicit empty argument.  Some shells do nothing, some change to the
+first entry in @env{CDPATH}, some change to @env{HOME}, and some exit
+the shell rather than returning an error.  Unfortunately, this means
+that if @samp{$var} is empty, then @samp{cd "$var"} is less predictable
+than @samp{cd $var} (at least the latter is well-behaved in all shells
+at changing to @env{HOME}, although this is probably not what you wanted
+in a script).  You should check that a directory name was supplied
+before trying to change locations.

bash's behavior is to do nothing.

Actually, bash's behavior is to change to the first directory in CDPATH.

Oops, no CDPATH here (and in any m4sh script).

Paolo



reply via email to

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