🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1094

Re: bourne shell query

#1094
From: Bob Goudreau
Date: Fri, 07 Sep 1990 19:30
35 lines
1701 bytes
In article <MEISSNER.90Sep6122432@osf.osf.org>, 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.90Sep5124415@tab29.larc.nasa.gov>
> | 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
Technical Details
Message-ID: <1990Sep7.193010.26787@dg-rtp.dg.com>
Path: arc1-ca.pugleaf.net!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
References: <75@iconsys> <925@hls0.hls.oz> <MEISSNER.90Sep6122432@osf.osf.org>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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> <MEISSNER.90Sep6122432@osf.osf.org>
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