Hi all. I am using procmail to deliver an email to a script I am developing. Procmail delivers the email to the script on standard input. I imagine this is the same as piping input from a command into the script. Hence I've been testing my script by running
echo 'test' | sms-autosend-backup.sh
I would expect the script to echo out the input passed to it, but this does not happen, I just get a blank line. My question is, how do I store standard input in a variable in my script? Is $1 not correct? Script is below. Thanks!
#!/bin/bash -norc
message=$1
echo $message
My .procmailrc looks like this:
VERBOSE=off
HOME=/home/sms-dev
MAILDIR=/var/spool/mail/sms-dev
LOGFILE=$HOME/procmail.log
SH=/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
:0
* ^TOsms-dev@sms.sms.local
{
:0c
| /home/sms-dev/sms-autosend.sh
:0
/var/spool/mail/sms-dev
:0
/home/sms-dev/mboxtest
}