![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| capturing line from script output and appending to a file | wally_welder | Shell Programming and Scripting | 6 | 08-31-2007 03:03 AM |
| Reading from blocking fifo pipe in shell script | victorin | Shell Programming and Scripting | 4 | 05-08-2007 11:39 AM |
| Pipe data to shell script | tomjones07 | Shell Programming and Scripting | 3 | 03-14-2007 07:50 PM |
| Capturing a ret val of C obj file in ksh script | k_bijitesh | High Level Programming | 5 | 05-16-2006 07:20 AM |
| Capturing shell script command output | designflaw | Shell Programming and Scripting | 2 | 03-01-2006 04:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need help capturing pipe to a file in shell script
The command:
echo "this is some text" | shellscript abc def ghi My problem: How to capture "this is some text" so that I can process it, I.e. capture to a file. What I'm attemting to do is process the text echo'd into a file after writing the parameters passed first. No problem capturing abc, def, ghi into environment variables. I just can't get the text that's being piped to shellscript. I'm trying to simulate mail/mailx in shellscript. Thanks in advance for your help. Heinz |
|
||||
|
It sounds like you're trying to use a shell script to read from stdin (this is what you must do to capture "this is some text" from the echo command.)
Try inserting this line into your shell script. This captures the text from echo "this is some text" and stores it into $TEXT ------------------------------------ #!/bin/sh TEXT="" for foo in `cat /dev/stdin` do TEXT=$foo done echo "Captured Text: $TEXT" ------------------------------------------- A helpful article can be found here: http://lists.debian.org/debian-user/.../msg01220.html |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|