Newsgroups: comp.os.misc
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!lavaca.uh.edu!menudo.uh.edu!sugar!ficc!peter
From: peter@ficc.ferranti.com (Peter da Silva)
Subject: Re: Globbing
Message-ID: <B.3A_=8@xds13.ferranti.com>
Reply-To: peter@ficc.ferranti.com (Peter da Silva)
Organization: Xenix Support, FICC
References: <17602@lanl.gov> <WG0A148@xds13.ferranti.com> <18205@lanl.gov> <A23AFH9@xds13.ferranti.com> <18365@lanl.gov>
Date: Tue, 19 Mar 91 23:16:22 GMT

In article <18365@lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes:
> No, you don't.  If no tool but the ultimate consumer _ever_ expands
> wildcards, then quoting need be used only if you have wildcard chars
> that you don't want the ultimate consumer to expand.

But you don't *know* that only the ultimate consumer is going to expand
wildcards. We're talking about random programs written by random people
at random times for random purposes with random levels of debugging. At
least in UNIX you know that anything you get has been expanded already,
and there is no reason to do so again.

What you're saying makes perfect sense in an ideal world, but that's what
I've been saying all along. In the real world, you have to assume that
the program you're passing stuff to might decide to glob it.

> I've seen scripts with 8 consecutive backslashes (\)
> because the programmer wanted _one_ to be literally present in the
> ultimate context of the argument - and it was only going through
> 2 intermediate commands.

Sounds like the programmer screwed up somewhere. I've never had to nest
more than two quotes. Of course using backslashes instead of quotes to
quote the argument is probably a mistake.

> |> 	OPEN(NAME='JGTEST.TXT',TYPE=UNKNOWN)

> Good example!  Note how the ultimate consumer of the string "JGTEST.TXT"
> will get exactly that string

But that's not the string he started with. He started with "'JGTEST.TXT'".
He quoted it at the top level (the language) and it then went all the way
down with no further quotes because none of the levels in the way did any
globbing. Your argument that tools should glob is like expecting OPEN to
glob.

> Still, the difference between what I want and what other programming
> languages do is trivial - I just pointed it out:  The arguments should
> only be evaluated _once_ in either the command or the programming language.

And they are. And they are evaluated in a context where the meaning of
the argument is known: by the caller. The shell is still a programming
language, however much you deny it.
-- 
Peter da Silva.  `-_-'  peter@ferranti.com
+1 713 274 5180.  'U`  "Have you hugged your wolf today?"
