[clue-tech] shell globbing and case

David L. Willson DLWillson at TheGeek.NU
Mon Mar 1 16:52:58 MST 2010


I'm writing a Nagios plug-in, and adhering to the developer guide, and writing in bash script.
According to the book, I should support threshold statements like

42
11:
:42
11:42

where my script alerts when the thing being measured is

above 42
below 11
above 42
above 42 or below 11

The bash "case" statement accepts some pretty wild things.  As I understand it, it's behavior mimics the capabilities of bash's file-selection wildcards.  I just learned, for example, that you can use character-classes like [[:digit:]] and [[:alpha:]] with both.

Does anyone have a recommendation for an on-line or local resource with a good discussion of the the capabilities?  It's not regular regex, but it's a Heck of a lot more than just * and ?, too.

I'm trying to setup a case statement, something like this plain English.

(one or more digits)
(one or more digits, followed by a colon)
(a colon, followed by one or more digits)
(one or more digits, a colon, one or more digits)

David L. Willson
Trainer, Engineer, Enthusiast
MCT MSCE N+ A+ L+ NovellCLA LPIC-1
tel://720.333.LANS
Freeing people from the tyranny (or whatevery) of Microsofty-ness, one at a time.


More information about the clue-tech mailing list