[bash] how to use _piped_ data in a shellscript?

If you want to talk about your personal paperweight, you've found the right place!

Moderator: Moderators

Post Reply
joe3
Advanced Hen
Posts: 200
Joined: Sun May 06, 2007 21:28

[bash] how to use _piped_ data in a shellscript?

Post by joe3 » Tue Apr 01, 2008 21:59

I have a utility script that among other things opens a personal "snippage" text file for interactive editing with vim. Here is a section of the shellscript:

- - - - - - - - -< s n i p >- - - - - - - - - -

if [ [email protected] == "" ]
then
echo "No snipData in arg list"
else
echo "
+++++++======== begin (arg list) snipData on "`date`"
[email protected]
+++++++======== end snipData
">>$snip/toit.txt
fi

- - - - - - - - -< s n i p >- - - - - - - - - -

With this I can get the contents of a text file appended to toit.txt with a command like:

$ toit `cat test.txt`

But what I want to be able to do is to accomplish the same thing by.

$ cat test.txt|toit

But I have no idea how to redirect the piped input into a variable so that my script can manipulate it...

Would someone be so kind as to give me a clue?
--
joe3


Post Reply