tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ Bullet proof way to find return codes

Help! - Starting tcsh as default shell ▻

shell problem under 2.6

In article <7jhddc$jg9$2@uuneo.neosoft.com>,
Chuck Campbell  <campbell@neosoft.com> wrote:
>The following works perfectly under solaris 2.5.1, but on a recently installed
>2.6 machine, I don't get the proper std error redirection into the log file.

>2>&1 tripwire -initialize -v > /trip_initialize.log

I'm sceptical that this ever did what you thought it was doing.  (More
likely, there was no error output under 2.5.1.)

Here's an explanation of the phenomenon for rc: the same applies to sh,
although the syntax is slightly different.

       In order to duplicate a file descriptor, use >[n=m].  Thus
       to redirect both standard output and standard error to the
       same file, use

            command > file >[2=1]

       As in sh, redirections are processed from left  to  right.
       Thus this sequence

            command >[2=1] > file

       is  usually a mistake.  It first duplicates standard error
       to standard output; then redirects standard  output  to  a
       file,  leaving  standard  error  wherever  standard output
       originally was.

Tim.
--
Tim Goodwin   | `I can't believe that someone is releasing
University of | something called "Unix" without something
Leicester, UK | called "/bin/sh".' -- Randal L. Schwartz

Original headers:

From: tjg@ltpcg.star.le.ac.uk (Tim J Goodwin)
Newsgroups: comp.unix.solaris,comp.unix.shell
Subject: Re: shell problem under 2.6
Date: 8 Jun 1999 11:45:31 +0100
Organization: University of Leicester, UK
Message-ID: <7jis8b$e5v$1@ltpcg.star.le.ac.uk>
References: <7jhddc$jg9$2@uuneo.neosoft.com>

△ comp.unix.shell △

◅ Bullet proof way to find return codes

Help! - Starting tcsh as default shell ▻