[Bash-completion-devel] Style proposals: case labels and [[ ]]
Ville Skyttä
ville.skytta at iki.fi
Thu Nov 19 21:31:12 UTC 2009
On Thursday 05 November 2009, Ville Skyttä wrote:
> Hello,
>
> I'd like to propose two coding style guidelines:
No comments? Silence means acceptance?
> 1) Avoid fancy globbing in case labels, just use traditional style when
> possible. For example, do "--foo|--bar)" instead of "--@(foo|bar))".
> Rationale: the former is easier to read, often easier to grep, and doesn't
> confuse editors as bad as the latter (in my case GNU Emacs), and is concise
> enough.
>
> 2) Use [[ ]] instead of [ ] when testing multiple conditions ([ ] is fine
> for single conditions where the syntax works). Rationale: [[ ]] has short
> circuit behavior within one test containing multiple conditions separated
> by && or ||, while [ ] with -a or -o does not. Thus it can be more
> efficient in some cases and may reduce need for nesting conditions, and
> it's cleaner to write for example [[ ... && ... ]] than [ ... ] && [ ...
> ], and in general [[ ]] has more features. (I wouldn't be opposed to a
> guideline always preferring [[ ]] over [ ], multiple conditions inside it
> or not.)
More information about the Bash-completion-devel
mailing list