On Sun, Nov 06, 2005 at 12:31:49AM -0600, Gilbert Sebenste wrote:
-=-=-=- #!/bin/sh foo=`grep -- " IL "` if [ "$foo" ]; then echo "$foo" | /bin/mail -s "ALERT: LOOK OUT!!!" user@machine.com fi -=-=-=-
This should do what you want without dealing with temp files and descriptors.
The problem is, what if I have three descriptors, or maybe 4, AND if there is a certain word or words in there, then don't send it out? In a file, it makes it easier.
Well, I guess so... Without seeing examples of what you mean I can't really comment one way or the other.
On Sun, Nov 06, 2005 at 01:38:01AM -0600, Gilbert Sebenste wrote:
I removed the "$1" and it printed the correct file in the /blah/blah doirectory, but the script failed to spit out an email. Here's the input:
If the file is right, then the grep is fine. If you didn't get mail, then most likely your sendmail configuration isn't right.
As root, type:
# mailq -Ac
Does it show you any messages waiting? If so, your sendmail configuration is likely the problem.
It should hit on the first "IL". Can someone try this on FC4 and see what happens for you?
I still suspect wc or grep changed its options.
You're not using any options, and the so that really can't possibly be the problem. The grep and wc utilities are ancient Unix work-alikes; their syntax hasn't changed substantially in about 30 years, barring the addition or renaming of a few mostly rather esoteric features. It really can't; changing the syntax would break 3 decades of code, probably violate POSIX standards, and definitely irritate a lot of people. You're barking up the wrong tree here.