Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 1997 18:46:10 -0800 (AKDT)
From:      Steve Howe <un_x@anchorage.net>
To:        Zahemszky Gabor <zgabor@CoDe.hu>
Cc:        freebsd-questions <questions@freebsd.org>
Subject:   Re: What command line to redirect 'make world' warnings ?
Message-ID:  <Pine.BSF.3.95q.970527173802.1668B-100000@aak.anchorage.net>
In-Reply-To: <199705270909.LAA00404@CoDe.hu>

next in thread | previous in thread | raw e-mail | index | archive | help

ouch!  you are hurting my brains! :)
i notice the sh man page says nothing about this stuff ...
and i also notice that the shell newsgroup is appears "dead".

> because redirection occures (most of the times) from left to right.

ok.

> > 	make world 2>&1 > /proxy/world3

stdout to tty
stderr to tty
redirection 2>&1
stderr to stdout (tty)
redirection > file
stdout to file

got it!  i think this is an easy mistake to make, since one would assume
if a stderr is duplicated on stdout, then any redirection of stdout would
also apply to stderr.

> 	make world > /proxy/world3 2>&1

stdout to tty
stderr to tty
redirection > file
stdout to file
redirection 2>&1
stderr to stdout (file)

got it.  i notice "make world > 2>&1 /proxy/world3" is an error,
but               "make world 2>&1 > /proxy/world3" is not! (sh)

i can't make sense out of this.  it seems to me they shoud either BOTH
be errors, or BOTH be functional. ???

> RTMF!  from bash manual:

Read The Manual xxxxhead! ??? hehe!

>	ls > dirlist 2>&1

stdout to tty
stderr to tty
redirection > file
stdout to file
redirection 2>&1
stderr to stdout (file)

>	ls 2>&1 > dirlist

stdout to tty
stderr to tty
redirection 2>&1
stderr to stdout
redirection > file
stdout to file

> 	      &>word
>        and
> 	      >&word
> 
>       Of  the two forms, the first is preferred.
>	This is semantically equivalent to
>
> 	      >word 2>&1
> 
> This type of redirection is working only in bash ...

so with bash one could say:

make world 2&>1 /proxy/world3

and get the desired effect, correct? (i don't have bash ...)

> ( make world 2>&1 >> /proxy/world3 ) > /proxy/world3

in a subshell:
stdout to tty
stderr to tty
redirection 2>&1
stderr to stdout
stdout >> file
end subshell.
--------------
redirection > file
stdout (subshell stderr) > file

got it!

> { make world 2>&1 >> /proxy/world3 ; } > /proxy/world3

same thing with grouping instead of subshell spawning.

> and you have to use append ( >> ) inside.  Well, why?  It's your exercise.

hmmm.  in sh, ">" inside works as well ... ???

> Bye, Gabor
-------------------------------------------------------------------------
 Sleep: a sign a caffeine deprivation ... http://www.anchorage.net/~un_x
-------------------------------------------------------------------------




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970527173802.1668B-100000>