On Wednesday 03 October 2007, Roy Marples wrote:
> On Tue, 2007-10-02 at 06:57 -0400, Mike Frysinger wrote:
> > > Pattern matching can be done just as well with case. Infact, tend to
> > > use [[ == ]] a lot when pattern matching when a case statement would be
> > > more efficient and use less code. Of course when you're just interested
> > > in matching one one thing in a code block then it uses more code, but
> > > that is probably outside the norm.
> >
> > case statements can be used in place of *some* statements, but not nearly
> > all and certainly does not provide the extended logic combining
> > capabilities. need to do boolean logic ?  say hello to convoluted nested
> > case statements!
>
> You can also do some pattern matching like so
>
> foo="foo foobar"
>
> [ "${foo%foobar}" = "${foo}" ] || echo "ends with foobar"
> [ "${foo#foobar}" = "${foo}" ] || echo "starts with foo"
> [ "${foo#* }" = "${foo}" ] || echo "has a space"
>
> So there's no need for convoluted nested case statements.

"no need" implies that everything can be done, but you started off 
with "some" ... you're still going from one clean logic statement to multiple 
ones where the nested logic gets to be a pita to track.  again, this is a 
sad/unacceptable solution.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to