Xref: utzoo comp.unix.questions:30604 comp.unix.wizards:25041 comp.unix.internals:2586 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!levels!xtdn From: xtdn@levels.sait.edu.au Newsgroups: comp.unix.questions,comp.unix.wizards,comp.unix.internals Subject: Re: Would somebody please explain? Message-ID: <16232.2811b071@levels.sait.edu.au> Date: 21 Apr 91 06:02:01 GMT References: <1991Apr21.001702.5661@umbc3.umbc.edu> <1991Apr21.023416.5795@mp.cs.niu.edu> Organization: University of South Australia Lines: 19 rouben@math16.math.umbc.edu (Rouben Rostamian) writes: >The command: > expr "Match" : "Ma" >returns 2, as it should, since the first two characters of "Match" and "Ma" >coincide. Now, would somebody please explain why the command: > expr "match" : "ma" >complains of a "syntax error"? It is, as you suggest, because you are using a builtin command incorrectly. I forget the exact details now, but I used often to suffer from similar problems with arguments that looked like numeric expressions. Anyway, the point is that if you prefix the argument with something that makes it look like nothing special, you won't suffer this type of problem. So, for example, use: expr "xmatch" : "xma" - 1 David Newall, 16:32:56.04, Tuesday, 1991 Phone: +61 8 344 2008 "Life is uncertain: Eat dessert first" E-mail: xtdn@lux.sait.edu.au