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