bug-bash
[Top][All Lists]
Advanced

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

Re: cd's Extraneous Arguments.


From: Chet Ramey
Subject: Re: cd's Extraneous Arguments.
Date: Tue, 19 Apr 2016 09:48:00 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

On 4/16/16 4:24 AM, Ralph Corderoy wrote:
> Hi Chet,
> 
>>> `cd foo bar xyzzy' changes directory to foo, complaining if it
>>> doesn't exist.  It doesn't complain about the unwanted extra
>>> arguments.  This can cause problems;  `cd *04' ends up in 2015-04,
>>> not 2016-04.
>>
>> If you want this behavior, you can build bash with CD_COMPLAINS
>> defined (adding it to CFLAGS is the easiest way).
> 
> Thanks, I didn't know of CD_COMPLAINS.  But I'm not trying to get this
> fixed for just me, deviating from my distribution's bash, I think it
> should be fixed in bash's normal configuration so other users aren't
> caught out by it, and the damage that can follow.
> 
> What's the argument for why CD_COMPLAINS behaviour isn't the default?

Because all versions of bash, and historical (and current) versions of
Posix shells, don't complain about multiple arguments to cd.  It's
never been the default behavior anywhere except ksh88/ksh93, which
actually behave differently with two directory arguments to cd.  It's
not a big enough deal to change that default, but there is a way for
people who want a different default to change it.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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