How do you pipe after a here document
Jim Rogers
jimr at hp-lsd.COS.HP.COM
Wed Nov 14 04:32:33 AEST 1990
Another approach is to use functions in your shell:
(This example works in KSH also)
#!/bin/sh
# create a function to pipe to, if you want
write_it () {
bold=`tput bold`
while read words
do
echo "${bold}${words}"
done
}
#Place the here document inside a function. The results of the function
#can be piped to any process which reads from stdin.
here_cat () {
cat << BYE
This is
the test
of the use
of a HERE
document
in the SH
BYE
}
# Invoke the "here function" and pipe its output to something.
here_cat | write_it
Jim Rogers
Hewlett Packard Company
More information about the Comp.unix.shell
mailing list