From: Stephen Samuel <samuel@bcgreen.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Christoph Pleger <Christoph.Pleger@uni-dortmund.de>,
linux-admin@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Redirection of STDERR
Date: Wed, 10 Mar 2004 08:39:18 -0800 [thread overview]
Message-ID: <404F44B6.8030202@bcgreen.com> (raw)
In-Reply-To: <jehdwylz0x.fsf@sykes.suse.de>
Yeah, you're right. I was tired when I wrote it,
however, the exec command still isn't quite
complete. Normally, you'd want a command to be
exec'ing.
In theory, the exec command by itself should (I think) just
redirect for the rest of your commands... However, it would
appear that there's a bug in bash for that syntax.
(i.e. If I type it in on the command line, It doesn't work for me, either).
In this case, I think you're going to be better off to just start
your processes with the output going direct logger...
my (more successful) way of doing this is:
{
command 1
command2
command3
} | logger -t $0[$$]
(needs a semicolon before the '}' if it's a one-liner.
It's also more portable (compatible with old bourne shells)
I prefer to save things like the named pipe syntax for the really
ornery situations where bourne-compatible syntax jusr doesn't
do the job.
Andreas Schwab wrote:
> Stephen Samuel <samuel@bcgreen.com> writes:
>>Christoph Pleger wrote:
>>>Hello,
>>>In my initialization scripts for hotplug (written for bash) the
>>>following command is used to redirect output which normally goes to
>>>stderr to the system logger:
>>>"exec 2> >(logger -t $0[$$])"
>>
>>I don't remember this syntax as legal.
>
> That's the process substitution feature of bash, quite handy when you want
> to get an fd connected to a pipe.
--
Stephen Samuel +1(604)876-0426 samuel@bcgreen.com
http://www.bcgreen.com/~samuel/
Powerful committed communication. Transformation touching
the jewel within each person and bringing it to light.
prev parent reply other threads:[~2004-03-10 16:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-08 10:13 Redirection of STDERR Christoph Pleger
2004-03-09 16:04 ` Stephen Samuel
2004-03-09 17:18 ` Andreas Schwab
2004-03-09 17:18 ` Andreas Schwab
2004-03-10 7:50 ` Christoph Pleger
2004-03-10 8:21 ` vda
2004-03-10 9:31 ` Andreas Schwab
2004-03-10 16:39 ` Stephen Samuel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=404F44B6.8030202@bcgreen.com \
--to=samuel@bcgreen.com \
--cc=Christoph.Pleger@uni-dortmund.de \
--cc=linux-admin@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=schwab@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.