Subject: Re: [shell-discuss] shellstyle
--------

I have a couple of corrections and a suggestion for the shellstyle draft.

Use ksh-style function.
        You have 'note that that "integer" is an alias for "typeset -il"'
        when it is actually an alias for "typeset -li".   Thus,
        integer 8 x=value can be used for octal integers.

Use autoload to load common functions, not source.
        A better suggestion would be to put functions in a directory and
        put the directory in both FPATH and in PATH.

Always use '{'+'}' when using variable names longer than one character.
        I would allow the {} to be omitted for simple named variables
        that are followed by a blank, /, ;, or $.

Always put variables into quotes when handling filenames or user input.
        There is no need for quotes with assignment, redirection words or
        inside [[...]].  They can also be omitted if IFS='' and set -o noglob.

Use compound variables or associative arrays to group similar variables 
together.
        typeset -A -E box=( "width"=56 "height"=10 depth=19 )
        is not correct.  It should be
        typeset -A -E box=( [width]=56 [height]=10 [depth]=19 )

Put $LINENO] in your PS4
        I think that you meant [$LINENO], or $LINENO.

David Korn
dgk at research.att.com

Reply via email to