From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: multios and unnecessary processes
Date: Mon, 10 Jan 2005 17:11:01 +0000 [thread overview]
Message-ID: <20050110171101.GD4432@sc> (raw)
In-Reply-To: <1050110165325.ZM26928@candle.brasslantern.com>
On Mon, Jan 10, 2005 at 04:53:25PM +0000, Bart Schaefer wrote:
[...]
> } ~$ zsh -o nomultios -c '{ lsof -ag $$ -d 0-2,10-15 2>&1 >&3 3>&- | tr a b 3>&-; } 3>&1'
>
> If the number of processes spawned is important, you have to know when
> to use curly braces and when to force a subshell with parens. Curly
> braces imply that the parent zsh sticks around and waits, whereas a
> subshell with parens can simply do an exec.
>
> zsh -fc '{ ( lsof -ag $$ -d 0-2,10-15 2>&1 >&3 3>&-; ) | tr a b 3>&-; } 3>&1'
>
> COMMAND PID PGRP USER FD TYPE DEVICE SIZE NODE NAME
> tr 26811 26811 schaefer 0r FIFO 0,0 72995 pipe
> tr 26811 26811 schaefer 1u CHR 136,7 9 /dev/pts/7
> tr 26811 26811 schaefer 2u CHR 136,7 9 /dev/pts/7
> lsof 26822 26811 schaefer 0u CHR 136,7 9 /dev/pts/7
> lsof 26822 26811 schaefer 1u CHR 136,7 9 /dev/pts/7
> lsof 26822 26811 schaefer 2w FIFO 0,0 72995 pipe
That makes sense but is not very intuitive given that (...) is
generally thought as the form spawning additional processes.
However to get back to my initial statement, don't you agree
it's a problem that
cmd >&2 >&- >&2
doesn't redirect stdout to stderr but to a pipe to a background
process that just echos the output to stderr?
That's not too big an issue. I was just trying to give some code
example in comp.unix.shell that would work the same for any shell
(including zsh with multios).
--
Stéphane
next prev parent reply other threads:[~2005-01-10 17:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-09 16:47 Stephane Chazelas
2005-01-09 20:32 ` Bart Schaefer
2005-01-10 9:49 ` Stephane Chazelas
2005-01-10 16:53 ` Bart Schaefer
2005-01-10 17:11 ` Stephane Chazelas [this message]
2005-01-10 19:20 ` Bart Schaefer
2005-01-10 19:48 ` Peter Stephenson
2005-01-11 9:07 ` Stephane Chazelas
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=20050110171101.GD4432@sc \
--to=stephane_chazelas@yahoo.fr \
--cc=zsh-workers@sunsite.dk \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).