An easy 50 pointer - hopefully :)
Posted on 2002-04-18
I'm writing a simple script and am having trouble with wildcards and string searching.
OK, my problem:
I have a script already called "lpck" which polls a pre-defined list of printers and executes the lpstat... command against them to see whether they are up and printing or down.
What I want my new script to do, is assign a variable to the output of the lpck script (easy part):
Then I want to search the_output for the word "DOWN" which will indicate that one of my printers is not functioning.
Now, I know how to test for numbers etc using the if ... then ... loop, but how do I say:
If [ "whatever the output from lpck is" matches "anything DOWN anythng" ]
I guess I need to use some sort of wildcard, although I've tried this:
if [ "$printstats" = "*DOWN*" ]
And it doesn't work.
Oh, I'm running AIX 4.3 and AIX 4.2 by the way, both on RS6000's.
Thanks in advance.