sendmail

Reading Stdin Bash style

Stephen
Have you ever had the need to read standard input in a bash script, for example cat /var/log/message | mycoolbashscript.sh Well i did when wrapping msmtp for use with mutt see the example bellow #!/bin/bash all=`cat "/dev/stdin"` if `/sbin/ifconfig eth0 | /bin/grep "inet addr" | /usr/bin/awk -F: '{ print $2 }'' | /usr/bin/awk '{ print $1 }'' | /bin/grep -qE '172\.31|32\.[0-9]{1,3}\.[0-9]{1,3}'`; then echo "$all" | tsocks msmtp -a account $* else echo "$all" | msmtp -a account $* fi I then setup mutt to use this as the sendmail binary set sendmail="~/utils/sendmail.