[Top][All Lists]

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

Re: bash silently ignores additional arguments for cd

From: Eric Blake
Subject: Re: bash silently ignores additional arguments for cd
Date: Wed, 07 Dec 2011 12:02:32 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

On 12/07/2011 06:21 AM, hanzl@noel.feld.cvut.cz wrote:
> Description:
>       cd silently ignores additional arguments
>       pwd, pushd and popd also do ignore additional arguments
>       This seemes to be a long standing behavior, it is the same in bash 
> 3.1.17.
>       Problem is also described here: 
> http://old.nabble.com/cd-with-multiple-arguments--td30418151.html
>       This bug is mostly benign, however missing newline at the end of a cd 
> command leads to
>       silent skip of the following command line. Error report would help here.
> Repeat-By:
>       cd xxx yyy
>       No error is reported for yyy.
> Fix:
>       Make bash to report error for superfluous arguments for cd, pwd, pushd 
> and popd.
>       Alternatively, describe current behavior in bash man page (and 
> preferably
>       explain - maybe it is required for compatibility with some historical 
> shell?)

Or even nicer, behave like zsh, and treat
 cd xxx yyy
like this (written assuming extglob syntax)
 cd xxx+($' \t')yyy

POSIX does not require 'cd xxx yyy' to fail, it only requires that
portable applications pass at most one argument to cd, such that passing
more than one argument triggers unspecified behavior.  We might as well
make that behavior intuitive.

Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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