Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
exec | wc isn't very useful...
- X-seq: zsh-users 8299
- From: Anthony Heading <aheading@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: exec | wc isn't very useful...
- Date: Wed, 15 Dec 2004 13:59:20 -0500
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Hi,
Can anyone tell me why this doesn't do what I'd hope:
exec | wc
I'm wondering how to redirect the shell's "default" stdout into
a process, e.g. do the equivalent of perl's
open(STDOUT, "| wc");
print "two words";
Obviously one can do "echo two words | wc", or "wc <(echo two words)"
or whatever, but that doesn't seem to lend itself too well to
conditional redirection, viz:
case $out in
script) exec > script.out ;;
gnuplot) exec | gnuplot ;; # doesn't work - hmm
stdout) ;;
esac
Equivalently, a sometimes appealing alternative to:
(
echo foo
echo bar
) > xyzzy.txt
is
exec > xyzzy.txt
echo foo
echo bar
but this doesn't seem to work for pipelines. Except that
perl can do it no trouble...
Pointers to anything I'm missing very welcome...
Rgds
Anthony
This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates
Messages sorted by:
Reverse Date,
Date,
Thread,
Author