Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.unix Subject: Re: Why do people use: if [ "x$FOO" = "x" ] .... ? Message-ID: <5514@utzoo.UUCP> Date: Sat, 20-Apr-85 19:34:33 EST Article-I.D.: utzoo.5514 Posted: Sat Apr 20 19:34:33 1985 Date-Received: Sat, 20-Apr-85 19:34:33 EST References: <361@ho95b.UUCP> <5046@ukc.UUCP>, <201@redwood.UUCP> Organization: U of Toronto Zoology Lines: 30 > Suppose you are asking for confirmation and you want any of "y", "ye", > or "yes", or "yo" or anything else starting with "y" to mean "yes", > and anything starting with "n" to mean "no". ... > > Using "$answer" doesn't work unless you explicitly list ALL of the choices, > since "*" isn't expanded inside strings... Huh? The following has always worked perfectly for us, on both V7 and SysV shells: case "$answer" in y*) echo yes ;; n*) echo no ;; *) echo huh ;; esac Just to be doubly sure, I just wrote out the above example and tried it. Works fine. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry