Piping here documents

Paul Falstad pfalstad at dae.Princeton.EDU
Fri Feb 8 16:11:14 AEST 1991


rhl at grendel.Princeton.EDU (Robert Lupton (the Good)) wrote:
>What's the best way of piping a here document into a long shell script?
>For a one liner

>#!/bin/sh
>cat <<-EOF | sed -e s/Hello/Goodbye/
>  Hello world
>EOF

These should give you some ideas:

#!/bin/sh
cat <<EOF | cat | cat |
Hello world
EOF
sed -e s/Hello/Goodbye/

or:

#! /bin/sh
cat <<EOF | (
Hello world
EOF
sed -e s/Hello/Goodbye/
echo foo
echo bar
)

If this won't help for what you're trying to do, please clarify.

--
Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
10 PRINT "PRINCETON CS"          | #include <std.disclaimer.h>
20 GOTO 10                       | [Your blood pressure just went up.]
Princeton University would like to apologize to everyone for this article.



More information about the Comp.unix.shell mailing list