>>>>> "Roland" == Roland Mainz <[EMAIL PROTECTED]> writes:

>> I'm happy to fix things that are bugs (like the missing double
>> quotes), but I'm reluctant to make purely stylistic changes that are
>> (a) inconsistent with the rest of the script

Roland> Well, IMO the rest of the script looks like a giant piece of
Roland> mixture of 7/8 bourne and 1/8 korn shell code... ;-(

I'm not enough of a shell connoisseur to notice the difference. ;-)

>> and (b) simply to conform to a not-yet-blessed style guide.

Roland> Well, I've send Mike Shapiro an email a while ago to comment on
Roland> the new styleguide but didn't receive any answers yet... ;-(

At this point, I think you'd want to get ON community's blessing, rather
than Mike's personal blessing.

>> +[ $? -eq 0 ] || fail "can't copy original proto area."

Roland> ksh script, please use (( )) for arithmetric expressions,
Roland> e.g. (( $? == 0 )) || fail ...

MK> I would like to wait until this aspect of the style guide is
MK> finalized (and formally adopted by ON).

Roland> OK (technically the idea was to make the code faster... [ ] and
Roland> [[ ]] operate on strings while (( )) operate on numbers (see
Roland> below)) 

So what happens if someone adds a string comparison to an existing (( ))
test?
 
>> shift $(($OPTIND - 1))

Roland> shift $((OPTIND - 1)) # should work, too (e.g. within ((
Roland> ))-expressions the '$' is not needed for variables)...

>> This was not clear to me from the ksh(1) man page, and it seems
>> likely to confuse future maintainers of the code.

Roland> Why should it be confusing ? $(( )) is for arithmetric
Roland> expressions and in such cases the variable name do not need the
Roland> '$'-prefix. 

Sure, it's obvious once you know how it works.  But it's puzzling if you
don't know.  ("Is it a typo?  Does this code even work right"?)  Also,
it means that if you're looking for references to OPTIND, you *cannot*
search for '$OPTIND', because it will fail to match $((OPTIND.  I'd be
very surprised if more than a couple people on this list knew that
before this email exchange.

People should be able to work on our scripts without being experts in
ksh arcanum.

mike
_______________________________________________
tools-discuss mailing list
tools-discuss@opensolaris.org

Reply via email to