Would somebody please explain?

Ric Anderson ric at optima.UUCP
Sun Apr 21 14:09:27 AEST 1991


>From article <1991Apr21.023416.5795 at mp.cs.niu.edu>, by rickert at mp.cs.niu.edu (Neil Rickert):
> In article <1991Apr21.001702.5661 at umbc3.umbc.edu> rouben at math16.math.umbc.edu (Rouben Rostamian) writes:
[stuff deleted]
>>coincide.  Now, would somebody please explain why the command:
>>    expr "match" : "ma"
>>complains of a "syntax error"?
> 
>   I just ran:  strings /bin/expr
> 
>   From the output I would guess that 'match', 'index', 'substr' and 'length'
> are builin functions or operators for 'expr', although they are not documented
> in any man pages that I have seen.

According to the man page on my system, the syntax of these
functions is :
string : re
match string re
	look in string for the regular expression "re".  returns
	the number of characters matched, or the string matched if
	\(...\) is used.

substr string integer-1 integer-2
	return the substring of "string" starting at integer-1,
	of length integer-2 characters.  1 = first character, and
	a length greater than whats left, returns whats left.

index string list
	return the position of the first character in "string" that
	occurs in "list"

length string
	return the length of "string".

Ric (ric at cs.arizona.edu <Ric Anderson>)



More information about the Comp.unix.wizards mailing list