piping a group of lines to a program - Networking
This is a discussion on piping a group of lines to a program - Networking ; hi all,
i want to send a group of lines to a program in a script shell.
now i'm using:
echo "line 1" > $TMPFILE
echo "line 2" >> $TMPFILE
....
echo "line N" >> $TMPFILE
cat $TMPFILE | prog
...
-
piping a group of lines to a program
hi all,
i want to send a group of lines to a program in a script shell.
now i'm using:
echo "line 1" > $TMPFILE
echo "line 2" >> $TMPFILE
....
echo "line N" >> $TMPFILE
cat $TMPFILE | prog
rm -f $TMPFILE
it seems me very primitive, create / delete a temp file only to
"group" the lines for piping
is it any method to pipe these line directly without temp file?
tks in advance
-
Re: piping a group of lines to a program
On 2007-05-30, rhXX wrote:
> i want to send a group of lines to a program in a script shell.
>
> it seems me very primitive, create / delete a temp file only to
> "group" the lines for piping
try with:
prog <
line 1
line 2
line 3
EOF
Davide
--
Driving is a video game, with only one life but many cars.
- from a letter on The Register
-
Re: piping a group of lines to a program
rhXX wrote:
> hi all,
>
> i want to send a group of lines to a program in a script shell.
>
> now i'm using:
>
> echo "line 1" > $TMPFILE
> echo "line 2" >> $TMPFILE
> ...
> echo "line N" >> $TMPFILE
>
> cat $TMPFILE | prog
>
> rm -f $TMPFILE
>
> it seems me very primitive, create / delete a temp file only to
> "group" the lines for piping
>
> is it any method to pipe these line directly without temp file?
>
> tks in advance
(echo "line 1"; echo "line 2"; ... ; echo "line N") | prog
-
Re: piping a group of lines to a program
ok, tks to all for inmediatly help!
sincerely