Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!zaphod.mps.ohio-state.edu!swrinde!emory!mephisto!mcnc!rti!dg-rtp!dg-rtp.dg.com!goudreau From: goudreau@dg-rtp.dg.com (Bob Goudreau) Newsgroups: comp.unix.shell Subject: Re: bourne shell query Message-ID: <1990Sep7.193010.26787@dg-rtp.dg.com> Date: 7 Sep 90 19:30:10 GMT References: <75@iconsys> <925@hls0.hls.oz> Sender: usenet@dg-rtp.dg.com (Usenet Administration) Reply-To: goudreau@dg-rtp.dg.com (Bob Goudreau) Organization: Data General Corporation, Research Triangle Park, NC Lines: 35 In article , meissner@osf.org (Michael Meissner) writes: > In article <1990Sep6.141133.3391@usenet.ins.cwru.edu> > chet@cwns1.CWRU.EDU (Chet Ramey) writes: > > | In article > | scott@tab29.larc.nasa.gov (Scott Yelich) writes: > | > | >1) if [ "$1" = "$2" ]; then > | > echo "Yeas!" > | > else > | > echo "No-way!" > | > fi > | > | What if $1 = '=' or '-t'? > > The standard way of dealing with this is: > > if [ x"$1" = x"$2" ]; then > echo "Yeas!" > else > echo "No-way!" > fi Why is even the "x" method necessary? My system's Bourne shell (a port of V.3.2's sh) doesn't have any problem handling '=' or '-t' in the example Scott Yelich describes above. Is this something AT&T fixed in the last couple of years? ---------------------------------------------------------------------- Bob Goudreau +1 919 248 6231 Data General Corporation 62 Alexander Drive goudreau@dg-rtp.dg.com Research Triangle Park, NC 27709 ...!mcnc!rti!xyzzy!goudreau USA