Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!bionet!agate!e260-1a.berkeley.edu!c60b-1eq From: c60b-1eq@e260-1a.berkeley.edu (Noam Mendelson) Newsgroups: comp.unix.questions Subject: Re: Would somebody please explain? Message-ID: <1991Apr21.085916.28516@agate.berkeley.edu> Date: 21 Apr 91 08:59:16 GMT References: <1991Apr21.001702.5661@umbc3.umbc.edu> Sender: root@agate.berkeley.edu (Charlie Root) Organization: University of California, Berkeley Lines: 18 In article <1991Apr21.001702.5661@umbc3.umbc.edu> 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"? Remember that 'expr string : regexp' is a pseudonym for 'expr match string regexp'. When you use "match" as the first argument, expr expects two additional arguments (i.e., expr is interpreting the "match" as a command). -- +==========================================================================+ | Noam Mendelson ..!ucbvax!web!c60b-1eq | "I haven't lost my mind, | | c60b-1eq@web.Berkeley.EDU | it's backed up on tape | | University of California at Berkeley | somewhere." |