simple question about mv

Mike Taylor mirk at warwick.UUCP
Thu Feb 9 23:59:11 AEST 1989


In article <626 at jonlab.UUCP> jon at jonlab.UUCP (Jon H. LaBadie) writes:
>Randal and others (this is not intended to pick on Randal's suggestion)
>have proposed work-arounds to UNIX's command line interpreters (or to
>mv's) deficiency in wild card matching.
[He is referring to "wrong" behaviour of commands such as "mv *.flip *.flop"]

Hmmm, you'd like to blame this one on UNIX's wild-card handling, would
you?  Well, think about it.  In UNIX, the shell (whichever you choose
to use) does *all* wildcard expansion, and passed the result to
whatever commands are invoked.  There is, therefore, a single, well-
defined and well-understood patern of behaviour.  The alternative,
and this is what MSDOS does, is for each command to include its own
pattern-matching code, so that, firstly, the wheel is re-invented over
and over, and secondly, and IMHBDO much more seriously, different
commands may expand wildcards in different ways.

What you suggest is an example of this: The "*" in the mv(1) command
is required to act differently from that in, for instance, the command
"cp file1 file2 file3 dir", or "cp file* dir".  This sort of
incosistency, while it makes things more immediately intuitive for the
novice, means that there is no real understanding of how such things
will work in a general case - surely not a good state of affairs.

Sorry if this sounds like flamage, you do make some good points in
your article, (eg: that all the proposed solutions seem to involve
invoking a new process other than the mv(1)s themselves)  But it is
important to have consistency, and I think that UNIX's approach to
pattern matching is optimal.  Let's all remember Henry Spencer's
signature, shall we?

	"Those who do not understand UNIX are condemned to
	 re-invent it, poorly."
______________________________________________________________________________
Mike Taylor - {Christ,M{athemat,us}ic}ian ...  Email to: mirk at uk.ac.warwick.cs
Unkle Mirk sez: "You fritter and waste the hours in an offhand waistcoat." :-)
------------------------------------------------------------------------------



More information about the Comp.unix.questions mailing list