Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!ames!ucbcad!ucbvax!jade!eris!mwm From: mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) Newsgroups: comp.sys.amiga Subject: Re: Pattern Matching & documentation Message-ID: <1943@jade.BERKELEY.EDU> Date: Tue, 16-Dec-86 06:26:23 EST Article-I.D.: jade.1943 Posted: Tue Dec 16 06:26:23 1986 Date-Received: Thu, 18-Dec-86 03:18:56 EST References: <954@blia.BLI.COM> <1731@jade.BERKELEY.EDU> Sender: usenet@jade.BERKELEY.EDU Reply-To: mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) Organization: Missionaria Phonibalonica Lines: 140 In article <357@pttesac.UUCP> vanam@pttesac.UUCP (-Root Admin-) writes: >In article <1908@jade.BERKELEY.EDU> mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) writes: >>In article <3313@curly.ucla-cs.UCLA.EDU> cc1@locus.ucla.edu (Michael Gersten) writes: >>>As for shell scripts, I'm not sure I understand the question/complaint. >> >>Consider a shell script: >> >> for i in $* >> do >> echo $i >> done >> >>which acts like echo, but puts each word on a seperate line. Now, try >>convincing it to echo a "*". Notice that your quoting mechanisms don't >>work right. > >Maybe I don't understand exactly what you're trying to do, but it seems >to work just fine here (I'm running on Sys V release 2 unix) if I type >'echo "*"', the system echoes an asterisk. All I have to do is quote it. You're right, you don't understand what I'm trying to do. Watch: Script started on Tue Dec 16 02:48:11 1986 eris% cat > lecho for i in $* do echo $i done ^D eris% chmod 777 lecho eris% lecho this is a test this is a test eris% lecho * bin dead.article lecho news root services src things.to.do tmp typescript eris% lecho \* bin dead.article lecho news root services src things.to.do tmp typescript eris% lecho '*' bin dead.article lecho news root services src things.to.do tmp typescript eris% lecho \\* No match. eris% lecho '\*' \* eris% lecho \\\* \* eris% ^D script done on Tue Dec 16 02:49:15 1986 [Enter extreme sarcasm mode.] So explain why the nice, clean, consistent file expansion breaks for the command lecho (_l_ine echo)? Geez, I thought quoting always worked. [Exit extreme sarcasm mode.] Ok? Can you propose a fix? I can - two of them. Both have been mentioned here by me and others. 1) Tag each command as to whether it should have file names expanded. Unwieldy for a number of reasons, previously explained. 2) Allow each command to do it's own pattern matching. We've hashed this over already, but I'll talk about it more later [collective groan and lot's of 'n' keys being hit, I'm sure.]. >If I want to pass a '*' on the command line, I also quote it. If I want >to pass a quoted '*' on the command line, then I quote the quote >with a backslash as in '\*'. Except, as demonstrated above, it doesn't always work. >In any case, to put in my 2 cents, I want to see the CLI do consistent >file name expansion. I don't want each individual program to do it in >it's own way. I don't have any problems with file name expansion with >the unix shell, and I don't see why I would with my Amiga. I see far to many problems with Unix file name expansions, and they've caused the shell to get bigger and uglier since Unix v6. And all the problems *still* haven't been solved. I don't want to see the AmigaDOS CLI start down this road!!!! A good solution will have the following properties: 1) All commands accept the same regular expressions for patterns. 2) If it doesn't make sense to have more than one word for an argument, that argument is NOT patterned matched. 3) Each argument is pattern matched against all objects with the same "type" as the argument, if it's pattern matched at all. There are two ways to do this. 1) Provide a library of routines to do the pattern matching. By making this a shared library, you can tweak the syntax of the regular expressions on your system, and it will work for EVERY command the same way. The problem is, you have to convince programmers to use this facility. 2) Provide a CLI that knows about what the arguments to a command are, and does the right thing. This still requires someone to do the work of describing the arguments, but allows the user to do it. A good CLI on these lines could make the Unix shells look like they were straightjackets when it comes to flexibility. A super version of this could be a TWENEX-like CLI, as described by mic@ngp.utexas.edu (haven't ever used tops-20/twenex, so I forgot about it; you're right, mic - it'd be a lot nicer than VMeSs.) Look, even Matt Dillon doesn't want the CLI to expand file names. He's truly pegged it: if you really don't like it, write your own shell (I've written a few for Unix; it's not hard). Leave the CLI small so that people running different shells don't have to pay for features they don't need from it. If you really feel unable to write your own shell, either buy one that's on the market, or get one of the (three? four? more?) PD ones that's floating around.