On Sat, Nov 01, 2008 at 11:21:01PM -0000, Sven Mascheck wrote:
[...]
> >>>>  : > stdout > stderr
[...]
> > It fails on old Ultrix sh, which can't redirect the same fd more than once
> > in a single statement.  But that platform is relatively dead these days.
> 
> More detailed:
> 
> - It actually works (also on Ultrix) but it is not robust
>    in any traditional Bourne shell (except where fixed by the vendor):
> 
>   $ echo x y > file1    > file2 # ok, all output in file2
>   $ echo x   > file1 y  > file2 # not ok, all output in file1 instead of file2
[...]

Hi Sven,

is it the order of the redirections that is not respected in
those old Bourne shells, or is it that only some of the
redirections are performed?

Would

: > file1 > file2
or
: > file1 x > file2

create (and truncate) both file1 and file2 in any case?

Would that fork a process, BTW in those old shells?

Maybe a better way would be

exec 3> file1 3> file2 3>&-
(to truncate those files)

-- 
Stéphane


Reply via email to