Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: multios and unnecessary processes
- X-seq: zsh-workers 20659
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: Re: multios and unnecessary processes
- Date: Sun, 9 Jan 2005 20:32:18 +0000
- In-reply-to: <20050109164753.GA4246@sc>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20050109164753.GA4246@sc>
On Jan 9, 4:47pm, Stephane Chazelas wrote:
} Subject: multios and unnecessary processes
}
} zsh -c 'lsof -ag $$ -d0-2,10-15 >&2 >&- >&2'
}
} and
}
} zsh -c 'lsof -ag $$ -d0-2,10-15 >&2'
}
} To work the same.
Interesting. For me, they *do* work the same *if* the command is run
from the shell prompt rather than from "zsh -c". In fact, I can only
reproduce your results if I use a non-interactive shell. If I put those
two commands in files and execute the files with "zsh -if" I get (in
both cases):
OMMAND PID PGRP USER FD TYPE DEVICE SIZE NODE NAME
zsh 22683 22683 schaefer 0u CHR 136,8 10 /dev/pts/8
zsh 22683 22683 schaefer 1u CHR 136,8 10 /dev/pts/8
zsh 22683 22683 schaefer 2u CHR 136,8 10 /dev/pts/8
zsh 22683 22683 schaefer 10r REG 3,1 36 159782 /tmp/lsof1
zsh 22683 22683 schaefer 11u CHR 136,8 10 /dev/pts/8
But if I leave off the -i I get the extra pipe descriptors in the first
case. I don't know offhand why multios would behave differently when
the shell is interactive.
} I came accross this while trying to make some code independant
} of the multios setting (hence the >&- to cancel the teed
} redirection).
I'm a little puzzled by that statement, because in your second example
there is no teed redirection. It's only the doubled >&2 that creates
a teed redirection in the first place.
The right way to write multios-independent code is to wrap things in
curly braces, e.g.: { lsof -ag $$ -d0-2,10-15 >&2 } >&2
} I'm not too sure it's a good idea to make multios the default.
If I had been in Paul Falstad's place 15 years or so ago, I'd have
thought about making the default value of multios follow the the initial
value of interactive; that is, having it on for interactive shells
unless explicitly turned off, and the reverse for non-interactive
shells. Maybe he did think about it, but that's not what he decided.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author