[clue-tech] shell globbing and case

Dennis J Perkins dennisjperkins at comcast.net
Tue Mar 2 06:22:10 MST 2010


On Mon, 2010-03-01 at 16:52 -0700, David L. Willson wrote:
> 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.
> _______________________________________________
> clue-tech mailing list
> clue-tech at cluedenver.org
> http://cluedenver.org/mailman/listinfo/clue-tech


You could try using =~ to do regular expressions, but I think that it
won't work with case.



More information about the clue-tech mailing list