home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast2.iso
/
calculat
/
expr.zip
/
READ.ME
< prev
Wrap
Text File
|
1990-04-21
|
2KB
|
30 lines
I've been running a lot of shell scripts lately. One construct
commonly used in many scripts is the colon operator of /usr/bin/expr,
which does regular expression matching. The Minix version of expr(1)
doesn't support this operator at all, and had problems with its support
of the rest.
Here is my replacement version. It implements everything
described in the V7 manual page, and behaves exactly as the 4.3BSD
version does. (I don't think this program has changed any since V7 -
it would have broken a lot of scripts.) It also passes lint, and
contains no cholesterol or artificial coloring.
The regular expression code is my own, as it was not possible
to use any of the commonly available regular expression matching
libraries. (expr(1) uses the ed(1) regexp syntax, while the libraries
implement extensions or improvements. The extraction operator also
would be difficult to get right if another library were used.) It
passes a modified version of Henry Spencer's regular expression test,
tailored for the BSD expr. There is one extension over the original
version - multiple \(...\) pairs are allowed. Don't use this feature
if you expect your scripts to work on V7/BSD/SysV. (The only reason
this feature has been addded is that I had done the design and part of
the coding work before I realized it was nonstandard. It seemed a
shame to rip out perfectly good code that increased the generality,
didn't hurt anything and didn't add significantly to the size.)
Bug reports appreciated.
-Peter S. Housel- housel@ecn.purdue.edu ...!pur-ee!housel