On Saturday 26 January 2008, Stephen Gran wrote: > This one time, at band camp, Frans Pop said: > > 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). > > This is an old, but relatively useful, method of catching garbage in a > variable. Imagine if $pvdev_found expands to '-z' - the test will blow > up and the script will exit. With the prefix test, you can continue, > although admittedly, not much useful will happen, except perhaps garbage > collection and error recovery. I guess that makes it useful in specific cases, for example when doing option processing, but I don't see how it makes it useful enough to be used by default, which I do see happen sometimes. If $pvdev_found would expand to something like '-z', there would be something seriously broken in partman, and I'd hope that we'd catch that before it'd be uploaded.
Attachment:
signature.asc
Description: This is a digitally signed message part.