On Saturday 26 January 2008, Colin Watson wrote: > On Wed, Jan 23, 2008 at 05:07:53PM +0100, Frans Pop wrote: > > Also: > > + if [ "X$pvdev_found" = 'Xyes' ]; then > > The X is not needed. The shell handles empty variables correctly if > > they have double quotes around them. Also, the quotes around "yes" are > > not needed (as it is a single word and not a variable). > > > > + if [ -z $schemevg ]; then > > + [ -z $pv_devices ] && bail_out no_pv_in_vg > > If these variables really can be empty then they definitely _should_ > > have quotes around them. Basically any variable that can be empty or > > consist of multiple words should be quoted, at least in tests. > > I would go further and say that every $ expansion should be surrounded > by "" unless you know that word splitting is not performed. (There are > cases where this is true, but they are rare; in general you'll be much > better off defaulting to quoting than not.) As a general rule, agreed. The only case where I structurally remove them is for numeric comparisons (e.g. '[ $count -lt 10 ]').
Attachment:
signature.asc
Description: This is a digitally signed message part.