Re: piping a groups of line to a program
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Wed, 30 May 2007 13:34:17 -0400
On 2007-05-30, 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?
{
echo "line 1"
echo "line 2"
...
echo "line N"
} | prog
Or:
printf "%s\n" "line 1" \
"line 2" ... \
"line N" | prog
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.
- Follow-Ups:
- Re: piping a groups of line to a program
- From: rhXX
- Re: piping a groups of line to a program
- References:
- piping a groups of line to a program
- From: rhXX
- piping a groups of line to a program
- Prev by Date: Re: User account with permissions to reboot
- Next by Date: Re: piping a groups of line to a program
- Previous by thread: Re: piping a groups of line to a program
- Next by thread: Re: piping a groups of line to a program
- Index(es):
Relevant Pages
|