Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!elroy.jpl.nasa.gov!usc!apple!amdcad!dgcad!dg-rtp!sheol!throopw From: throopw@sheol.UUCP (Wayne Throop) Newsgroups: comp.arch Subject: Re: shell architecture (to glob or not to glob) Summary: "intuitive" doesn't imply "reasonable" or "desirable" Message-ID: <1407@sheol.UUCP> Date: 18 Mar 91 00:53:59 GMT References: <378@bria> <19062@cbmvax.commo <5615@awdprime.UUCP> <488@bria> <00086@meph.UUCP> Lines: 46 > gsarff@meph.UUCP (Gary Sarff) >> > mv cmp* compress* >>Please. Not *this* example *again*. Yawwwwwwwwn. > I am struck by K. Wallewein's statement, "not *this* example *again*" > Think about it, think about the "again" part. That means it's common > isn't it? Many people say this, or want it, so might we wish to enquire > why? Maybe because it seems intuitive to them? Just because something is "intuitive" doesn't mean it's right, reasonable, or desirable. For example, just because most people find Aristotalian physics more "intuitive" than Newtonian physics doesn't mean that we should use Aristotalian models to explain things to people. Thus, the common "thinko"% that "mv *.x *.y" ought to do something sensible doesn't mean that we should rush right out and supply "the obvious" meaning to that construction. Having said that, I agree that renaming groups of files is a common enough task that *some* tool (whather mv or not) ought to be around to handle it. And I even agree that something like "mmv '*.x' '*.y'" might well be a good syntax to support it%%. But note that it would HAVE to be quoted in anything like the current shells, because the second '*' character is in NO way a wildcard expansion in this context. --- % This common thinko comes from a distinct misfeature in current shell argument syntax, IMO. Specifically, it is not lexically apparent how the positional argument binding is being done. This leads to the sub-thinko that each *.x corresponds to some *.y as is lexically apparent in the unexpanded form (but not in the shell-based expanded form). The rest of the thinko is a result of over-generalizing the meaning of the "*" to take the role of "&" (or perhaps \N) in Unix regular expressions. But again, the fact that the thinko is common doesn't mean it ought to be catered to or enshrined. %% I say *might* be... it would be nice to have (at least) the full power of ed-like regular expressions to express the renames, but it isn't clear how this can be reconciled with the goal of making the simple cases easy to express. In any event, with the shell "promiscuously globbing" as it usually does, the quotes would be necessary, because what's going on is NOT wildcard expansion. -- Wayne Throop ...!mcnc!dg-rtp!sheol!throopw