[prog] shell script problem
Noir
acknak_halflife at yahoo.co.uk
Wed Nov 30 20:54:30 EST 2005
Sorry about a small mistake. <STDIN> should be
substituted by <STDOUT> in most of the places.
--- Noir <acknak_halflife at yahoo.co.uk> wrote:
> I am writing this script to email me the output of a
> program.
> When I run the program (/usr/bin/program) it gives
> me
> a small output in <STDIN>. Basically, my bash script
> looks for an "okay" and if it finds it, it then
> email
> me the whole output <STDIN> with the subject header
> of
> the mail as $SUB1 else it sends me an email with
> subject as $SUB2 and the whole <STDIN> output.
> Following is my script & it doesn't quite do what I
> want. I ran it with "bash -x" and it gets stuck at:
> mail -s "$SUB1" $RECP
> Also, I am not quite sure how to get the whole
> <STDIN>
> in the body of the email.
> Following is the script:
> #!/bin/bash
> BINARY="/usr/bin/binary"
> CHECK="`$BINARY --check | cat -b | grep 2 | awk
> {'print $9'}`"
> RECPT="noir at yahoo.com"
> SUB1="binary check for `hostname` NOT ok"
> SUB2="binary check for `hostname` OK "
> OK="okay"
> if [ "$CHECK" != "$OK" ]; then
> mail -s "$SUB1" $RECPT
> else
> mail -s "$SUB2" $RECPT
> fi
> Any kind of help would be appreciated.
> TIA.
___________________________________________________________
WIN ONE OF THREE YAHOO! VESPAS - Enter now! - http://uk.cars.yahoo.com/features/competitions/vespa.html
More information about the Programming
mailing list