oh yeah...that's extremely handy.It also supports multiple results and case (as in upper or lowercase) variations, too. For example, you can use y|yes|YES) or [Yy][Es][Ss]) to test for variations on a "yes" response, where with "if" you'd need to make a long string to test for all of those variations.

One thing that's nice about this type of thread is how different users get deep into their particular issues on dsl, then provide a resource for the rest of us by posting. If I feel the urge to fiddle with some of this stuff , Mikshaw's already done the work for us - all I have to do is find it on the forum.

PS: I like case statements, too. I find them readable. Globbing in them can be handy also. For eg, Karl Knopper uses this type of thing a lot to test for a string within a string:

I suppose you'd only need to change your scripts if they were noticeably slow - which greps can certainly do if you're grepping moderately biggish files etc.

That famous C guy whats-is-name said "the best optimization is usually no optimization". He was referring to much optimization of code being insignificant on modern processors, therefore time wasting and bug prone, and that readability was more important.