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    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to