Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 (Denver Mods 4/2/84) 6/24/83; site drutx.UUCP Path: utzoo!linus!philabs!cmcl2!floyd!harpo!ihnp4!drutx!jas From: jas@drutx.UUCP (ShanklandJA) Newsgroups: net.unix Subject: Re: HELP! (What's wrong with this sh scr - (nf) Message-ID: <211@drutx.UUCP> Date: Tue, 24-Apr-84 14:54:31 EST Article-I.D.: drutx.211 Posted: Tue Apr 24 14:54:31 1984 Date-Received: Thu, 26-Apr-84 01:29:02 EST References: <3135@fortune.UUCP> Organization: AT&T Information Systems Laboratories, Denver Lines: 19 > To guard against this, always (1) use double-quotes around > your read-in strings and (2) pad such strings with a leading > character to keep them from ever being null: > if [ "X$ANSWER" = Xyes -o "X$ANSWER" = Xye -o "X$ANSWER" = Xy ] I've always wondered about this curious custom of prefixing strings with X (or whatever) to keep them from being null. Why? The System V Bourne shell finds null strings perfectly acceptable; of course, they have to be quoted, because the empty string is not the same as no string at all. In any case, I find that: if [ "$ANSWER" = yes -o "$ANSWER" = ye -o "$ANSWER" = y ] works just fine, even when $ANSWER is null. Those X's look ugly to me. Am I missing something? Jim Shankland ..!ihnp4!druxy!jas