![]() |
|
|
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 |
| reading XML datas via Shell Script | freepal | Shell Programming and Scripting | 1 | 02-08-2008 11:52 AM |
| Shell Script -- problem reading backslash(\)!! | rossi143 | Shell Programming and Scripting | 2 | 04-04-2007 03:52 AM |
| reading command output from shell script | sri b | Shell Programming and Scripting | 4 | 11-16-2006 12:52 AM |
| Help:error in reading from stdin | zhshqzyc | High Level Programming | 5 | 09-25-2006 04:58 PM |
| Reading a table in a shell script | luiscarvalheiro | Shell Programming and Scripting | 13 | 08-10-2006 07:16 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
reading from stdin in a shell script
Hello,
I've managed to get my .procmailrc file to work. At least it triggers a script which creates a file. But the file is empty. How do I get at the data that's been piped? I've done much creative googling to no avail. I belive it should be in stdin, but I can't figure out how to access it. Thanks Mike |
|
||||
|
Thanks Zaxxon,
I had tried variations of that. I don't really have anything to post because I was stuck at the beginning. Turns out the problem is with my understanding of procmail since your code works fine if I pipe to my script from another script. Here's the procmailrc if anyone has any knowlege of this stuff: :0 b |$HOME/test.sh My understanding is that this should pipe the body of the email to the script test.sh. As it stands right now, the script is triggered but there doesn't appear to be anything piped. I've used your suggestion in a script named "test.sh": while read LINE; do echo ${LINE} > t.log done exit 0 if I write a small script that says: echo "test" save it as t.sh and run it at the command line like this: ./t.sh|./test.sh then the file t.log is created and contains the line: test If I send an email to this mailbox the script test.sh is triggered but the file t.log contains only a blank line. That's where I'm at and I realize this isn't a procmail forum, but any help will be appreciated. |
|
||||
|
keep it simple people.. Code:
#!/bin/sh # Converts all lowercase text from # stdin to uppercase # tr '[:lower:]' '[:upper:]' < /dev/stdin # edward # ebaddouh@gmail.com you should call your script as follow: Code:
$ echo "keep it simple" | myscript.sh KEEP IT SIMPLE cheers |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|