Article View: comp.unix.shell
Article #1097test "x$a" = "x$b" (Re: bourne shell query)
From: Felix Lee
Date: Fri, 07 Sep 1990 23:39
Date: Fri, 07 Sep 1990 23:39
23 lines
1227 bytes
1227 bytes
> 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 '=' Modern Bourne shells appear to parse around '='. This makes cases like this: test -f = -f work, but watch out for these: eq='=' hy='-f' test "$eq" test "$hy" test -l "$eq" test -l "$eq" -lt 8 test -f "$eq" test "$hy" = -a test -f "$eq" -a ! -x "$eq" The way "test" parses its arguments doesn't appear to be documented. Fortunately, it doesn't take more than an hour to puzzle it out. Unfortunately, fixing the above expressions to work no matter what the value of $eq or $hy gets messy. -- Felix Lee flee@cs.psu.edu
Technical Details
Message-ID:
<Ft.$!1&1@cs.psu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!psuvax1!newsReferences:
<75@iconsys> <925@hls0.hls.oz> <MEISSNER.90Sep6122432@osf.osf.org> <1990Sep7.193010.26787@dg-rtp.dg.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!psuvax1!news From: flee@guardian.cs.psu.edu (Felix Lee) Newsgroups: comp.unix.shell Subject: test "x$a" = "x$b" (Re: bourne shell query) Message-ID: <Ft.$!1&1@cs.psu.edu> Date: 7 Sep 90 23:39:49 GMT References: <75@iconsys> <925@hls0.hls.oz> <MEISSNER.90Sep6122432@osf.osf.org> <1990Sep7.193010.26787@dg-rtp.dg.com> Sender: news@cs.psu.edu (Usenet) Organization: Penn State Computer Science Lines: 23 Nntp-Posting-Host: guardian.cs.psu.edu