Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
command substitution: zsh waits until command exits
- X-seq: zsh-users 12266
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: command substitution: zsh waits until command exits
- Date: Fri, 30 Nov 2007 14:39:43 +0100
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
The zshexpn(1) man page says:
COMMAND SUBSTITUTION
A command enclosed in parentheses preceded by a dollar sign, like
`$(...)', or quoted with grave accents, like ``...`', is replaced with
its standard output, with any trailing newlines deleted. If the sub-
stitution is not enclosed in double quotes, the output is broken into
words using the IFS parameter. The substitution `$(cat foo)' may be
replaced by the equivalent but faster `$(<foo)'. In either case, if
the option GLOB_SUBST is set, the output is eligible for filename gen-
eration.
but doesn't say when zsh does the substitution and runs the main
command (it should be clarified). For instance, with the following
command
echo $(echo foo; exec >&-; sleep 2)
zsh waits for 2 seconds before outputting 'foo'. However, since the
standard output fd of the substituted command has been closed, I assume
that zsh should be able to replace $(echo foo; exec >&-; sleep 2) by
'foo' and run the main command before the command inside $(...) exits.
Is this a bug?
Otherwise, is there a way to do what I wish (without temporary files)?
More precisely, I want to do something like:
some_command $(xterm -e 'tty >&3; exec 3>&-; sleep 999999' 3>&1)
so that some_command can write data to the xterm (in addition to the
normal output).
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author