Roy Marples wrote:
> On Tue, 2007-10-16 at 00:28 -0700, Donnie Berkholz wrote:
>> On 08:19 Tue 16 Oct , Steve Long wrote:
>> > stdDocs=(ChangeLog AUTHORS FEATURES THANKS README CodingStyle TODO FAQ)
>> >
>> > stdDoc() {
>> > local d l=()
>> > for d in "[EMAIL PROTECTED]"; do
>> > [[ -f $d ]] && l+=("$d")
>> > done
>> > (([EMAIL PROTECTED])) && dodoc "[EMAIL PROTECTED]"
>> > }
>> >
>> > (assuming [[ $PWD = $S ]] or whichever is the right one for docs.)
>>
>> Is it just me, or is this code way more complex than it needs to be? It
>> looks like bashturbation to me. =P
>
LMAO. It's as complex as it needs to be to handle filenames with spaces or
any other character in. Remember: "Looks like it needs quotes there.. $D,
$S.." What, I should write crap script for this esteemed audience, cos you
only currently deal with filenames without spaces? ;P
> Nope, it looks like milk and cereal decorating my monitor to me; after
> reading that! :)
>
Hmm..
> You can also do some pattern matching like so
>
> foo="foo foobar"
>
> [ "${foo%foobar}" = "${foo}" ] || echo "ends with foobar"
[[ $foo = *foobar ]] && echo "ends with foobar"
> [ "${foo#foobar}" = "${foo}" ] || echo "starts with foo"
[[ $foo = foo* ]] && echo 'oh does it?'
> [ "${foo#* }" = "${foo}" ] || echo "has a space"
>
[[ $foo = *'wow it '*"does as $well"* ]] && echo 'And a whole lot more!'
> So there's no need for convoluted nested case statements.
There's no need for borked script that is counter-intuitive, and doesn't
have a third of the functionality either. Or should *nix only ever support
POSIX APIs for everything? #define _X_OPEN_SOURCE? No? Hmm.. *shrug* ;>
/me wanders down the pub.. *plop*
--
[EMAIL PROTECTED] mailing list