bourne shell query
Bob Goudreau
goudreau at dg-rtp.dg.com
Sat Sep 8 05:30:10 AEST 1990
In article <MEISSNER.90Sep6122432 at osf.osf.org>, meissner at osf.org
(Michael Meissner) writes:
> In article <1990Sep6.141133.3391 at usenet.ins.cwru.edu>
> chet at cwns1.CWRU.EDU (Chet Ramey) writes:
>
> | In article <SCOTT.90Sep5124415 at tab29.larc.nasa.gov>
> | scott at 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 at dg-rtp.dg.com
Research Triangle Park, NC 27709 ...!mcnc!rti!xyzzy!goudreau
USA
More information about the Comp.unix.shell
mailing list