bug-bash
[Top][All Lists]
Advanced

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

Re: flag for quiet CDPATH


From: Chet Ramey
Subject: Re: flag for quiet CDPATH
Date: Tue, 21 Jan 2014 14:57:21 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

On 1/21/14 1:39 PM, Linda Walsh wrote:
> 
> 
> Lionel Cons wrote:
>> Yes, adding yet another option which can be implemented using POSIX
>> behaviour is IMHO code bloat. Just use alias cd='2>"/dev/null" cd '
>> (yes, POSIX mandates that re-directions can be prefixed and not only
>> postfixed).
> 
> ---
> But the above doesn't work.  The echo happens on stdout...I.e.
> need:
> alias cd=' cd >& /dev/null'
> 
> which does work.

You don't have to redirect stdout and stderr -- you might want error
messages without the informational ones.  And you are both right; the
grammar allows you to put redirections anywhere in a simple command.

> (FWIW, I tried it just with '2' before i read your note --
> I, too, am surprised it's not on stderr...)

Because that is how it's always worked, and how Posix specifies it:

    If a non-empty directory name from CDPATH is used, or if cd - is used,
    an absolute pathname of the new working directory shall be written to
    the standard output as follows:

    "%s\n", <new directory>

    Otherwise, there shall be no output.

Chet

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



reply via email to

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