[Bash-completion-devel] Style guide (was: Re: [SCM] bash-completion branch, master, updated. 95cd673b5cbd5658cbf56a56a4113722aab92177)

Ville Skyttä ville.skytta at iki.fi
Tue Apr 14 18:50:00 UTC 2009


On Tuesday 14 April 2009, David Paleino wrote:
> On Tue, 14 Apr 2009 18:24:23 +0000, Ville Skyttä wrote:
> > @@ -884,8 +885,14 @@ _mount()
> >
> >  				 | grep "^$cur" ) )
> >
> >  	else
> >  		# probably Linux
> > -		COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \
> > +		if [ $prev = -L ]; then
> >                       [..]
> > +		elif [ $prev = -U ]; then
> > +			[..]
> > +		else
> > +			[..]
> > +		fi
>
> Why not case..esac? :)

Yeah... why not :).  Anyone want to write a style guide?  Here's a start for a 
table of contents, in no particular order:

- case/esac vs if
- simple matching vs extended globbing in case statements: -@(a|b)) vs -a|-b)
- [[ ]] vs [ ]
- indentation
- line wrapping
- quoting
- awk vs cut for simple cases
- $(...) vs `...`
- variable and function naming



More information about the Bash-completion-devel mailing list