shell programming
Does anyone know how I can combine a pipe with an "&&"?
I have a script that mails some piped input, but I don't want it to mail
if no has no data.
Is there a command for exiting if no stdin, but if there is just pipe it
through?
Well, here is my script:
#!/bin/sh
LOGFILE=/var/named/logs/logfile
MAILTO=jcr@iwbc.net
SUBJECT="dns problems report"
grep `date +"%d-%b-%Y"` $LOGFILE | \
egrep 'reject|failed|error' | \
cut -f 3-100 -d " " | \
sort | \
uniq | \
mail -s "$SUBJECT" $MAILTO
Thanks,
Jeremy C. Reed
http://www.reedmedia.net
http://bsd.reedmedia.net
Reply to: