With ksh 2014-06-06 on OS X 10.7.4, I can't redirect the standard output
of a command to a command that is run via process substitution; e.g.:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ printf '%d\n' {1..20} > >(wc -l)
$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This instead causes the output of printf to be written to some
oddly-named file in the current working directory. bash 3.2.48 and zsh
4.3.11 produce the expected result.
Per the ksh 2014-06-06 man page:
"When available, process substitution is performed simultaneously with
parameter and variable expansion, command substitution, and arithmetic
expansion."
i.e., before redirection, so this seems like it should work.
My motivation is that I'd like to use process substitution to process
the output of a loop; e.g.:
for var in ...
do
...
done > >(...)
The loop modifies an associative array that is used later in the script,
so it has to be run in the current shell execution environment (i.e., it
can't be the first command in a pipeline).
I could redirect the output of the loop to a named pipe, but the purpose
of process substitution is to avoid the inconvenience of named pipes.
--
Nathan Weeks
IT Specialist
USDA-ARS Corn Insects and Crop Genetics Research Unit
Crop Genome Informatics Laboratory
Iowa State University
http://weeks.public.iastate.edu/
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users