Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!snorkelwacker.mit.edu!hsdndev!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.os.misc Subject: Re: Globbing Message-ID: <17097@lanl.gov> Date: 8 Mar 91 19:33:32 GMT References: Distribution: na Organization: Los Alamos Natl Lab, Los Alamos, N.M. Lines: 54 From article , by peter@ficc.ferranti.com (Peter da Silva): > In article kenw@skyler.arc.ab.ca (Ken Wallewein) writes: >> Peter, you asked me to come up with other examples besides the mv/rename >> one. [...] It wasn't easy; they don't exist now, as far as I know -- maybe >> due to a chicken-and-egg precedence problem > > Look for examples on VMS, DOS, AmigaDOS, etc. No catch-22 there. It's not hard to come up with enormous numbers of examples where the command language would be better if globbing were not done automatically by the shell. All you have to do is look at the assumptions that the shell is making when it automatically globs and consider cases that violate such assumptions. 1) The case everyone thought of first: you want globbing to produce _two_ distinct lists that correspond. This is the mv/rename example that everyone has been discussing. 2) You want an argument globbed, but _not_ in the context of the local filespace. For example, suppose you have an external mass storage device that you periodically save files from your local filesystem to or periodically load data from. You might want the syntax to look like "save " and "get ". But, you can't do this if the shell automatically globs because the is always globbed in the _local_ filespace - but for the 'get' command, you want it to be globbed in the context of the external filesystem. With the increasing importance of distributed processing, the ability to glob file arguments in _non-local_ contexts may be very valuable. 3) You want the argument globbed, but _not_ in the context of a filespace at all. After all, globbing is just a pattern matching facility - there are any number of lists of data which could benefit from making such a pattern match available for them. For example, you could have a version of 'ls' which allowed globbing on the owner or group fields: "ls -l *.p -group c-*" would list all '.p' files which are owned by someone in 'c' division (according to our naming convention for groups). It is no trick to come up with numerous examples of globbing that fit each of these three categories - or more than one at a time! For example, you may want one argument globbed as an account number and another argument to generate a corresponding list of (say) mail addresses based on the matched part of the account - a mix of categories (1) and (3) above. Note also that quoting and escape characters are _not_ sufficient to perform the above functionalities in the present 'automatic glob' environments. Quoting is supposed to prevent an argument from being globbed - but you _want_ all these arguments to be globbed, it's just that you want it done in a different context. J. Giles