Gentoo Archives: gentoo-dev

From: Steve Long <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Re: Re: [gentoo-commits] gentoo-x86 commit in dev-php5/onphp: ChangeLog onphp-0.10.6.ebuild onphp-0.10.4.ebuild onphp-0.10.3.ebuild
Date: Tue, 16 Oct 2007 12:53:00
Message-Id: ff2b49$v28$1@ger.gmane.org
In Reply to: Re: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in dev-php5/onphp: ChangeLog onphp-0.10.6.ebuild onphp-0.10.4.ebuild onphp-0.10.3.ebuild by Roy Marples
1 Roy Marples wrote:
2 > On Tue, 2007-10-16 at 00:28 -0700, Donnie Berkholz wrote:
3 >> On 08:19 Tue 16 Oct , Steve Long wrote:
4 >> > stdDocs=(ChangeLog AUTHORS FEATURES THANKS README CodingStyle TODO FAQ)
5 >> >
6 >> > stdDoc() {
7 >> > local d l=()
8 >> > for d in "${stdDocs[@]}"; do
9 >> > [[ -f $d ]] && l+=("$d")
10 >> > done
11 >> > ((${#l[@]})) && dodoc "${l[@]}"
12 >> > }
13 >> >
14 >> > (assuming [[ $PWD = $S ]] or whichever is the right one for docs.)
15 >>
16 >> Is it just me, or is this code way more complex than it needs to be? It
17 >> looks like bashturbation to me. =P
18 >
19 LMAO. It's as complex as it needs to be to handle filenames with spaces or
20 any other character in. Remember: "Looks like it needs quotes there.. $D,
21 $S.." What, I should write crap script for this esteemed audience, cos you
22 only currently deal with filenames without spaces? ;P
23
24 > Nope, it looks like milk and cereal decorating my monitor to me; after
25 > reading that! :)
26 >
27 Hmm..
28 > You can also do some pattern matching like so
29 >
30 > foo="foo foobar"
31 >
32 > [ "${foo%foobar}" = "${foo}" ] || echo "ends with foobar"
33 [[ $foo = *foobar ]] && echo "ends with foobar"
34
35 > [ "${foo#foobar}" = "${foo}" ] || echo "starts with foo"
36 [[ $foo = foo* ]] && echo 'oh does it?'
37
38 > [ "${foo#* }" = "${foo}" ] || echo "has a space"
39 >
40 [[ $foo = *'wow it '*"does as $well"* ]] && echo 'And a whole lot more!'
41
42 > So there's no need for convoluted nested case statements.
43
44 There's no need for borked script that is counter-intuitive, and doesn't
45 have a third of the functionality either. Or should *nix only ever support
46 POSIX APIs for everything? #define _X_OPEN_SOURCE? No? Hmm.. *shrug* ;>
47
48 /me wanders down the pub.. *plop*
49
50 --
51 gentoo-dev@g.o mailing list

Replies