1 |
On Sun, 2007-10-07 at 01:06 -0400, Mike Frysinger wrote: |
2 |
> > You can also do some pattern matching like so |
3 |
> > |
4 |
> > foo="foo foobar" |
5 |
> > |
6 |
> > [ "${foo%foobar}" = "${foo}" ] || echo "ends with foobar" |
7 |
> > [ "${foo#foobar}" = "${foo}" ] || echo "starts with foo" |
8 |
> > [ "${foo#* }" = "${foo}" ] || echo "has a space" |
9 |
> > |
10 |
> > So there's no need for convoluted nested case statements. |
11 |
> |
12 |
> "no need" implies that everything can be done, but you started off |
13 |
> with "some" ... |
14 |
|
15 |
Yes, the some being =~, which is the only operator I know of that cannot |
16 |
be done with posix sh |
17 |
|
18 |
> you're still going from one clean logic statement to multiple |
19 |
> ones where the nested logic gets to be a pita to track. again, this |
20 |
> is a sad/unacceptable solution. |
21 |
|
22 |
OK, it's time to pony up - show me a code snippet which you think a |
23 |
nested code snipet which you think is unworkable in posix sh when |
24 |
transitioning from [[ ]] to [ ]. |
25 |
|
26 |
=~ isn't allowed as that's a strict bashism. |
27 |
|
28 |
Thanks |
29 |
|
30 |
Roy |
31 |
|
32 |
-- |
33 |
gentoo-dev@g.o mailing list |