Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!lavaca.uh.edu!menudo.uh.edu!lobster!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.os.misc Subject: Re: Globbing Message-ID: Date: 21 Mar 91 15:56:29 GMT References: <17602@lanl.gov> <18205@lanl.gov> <18365@lanl.gov> <18511@lanl.gov> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 68 In article <18511@lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes: > |> Sounds like the programmer screwed up somewhere. I've never had to nest > |> more than two quotes. [...] > Then, you've never sent arguments to shell scripts which in turn > invoke shell scripts, which in turn invoke shell scripts, .... This > is a common practice on UNIX systems. Often, systems 'programs' are > implemented just that way. Sure I have. But one nice thing about shell scripts: you can fix the bloody things when they have bugs in them. And not properly quoting variables is a bug. This is just as bad as a program in VMS or AmigaDOS not globbing when it should, but with a major difference: it's fixable. > |> But that's not the string he started with. He started with "'JGTEST.TXT'". > The string he started with was -> JGTEST.TXT <- with no markers on it > at all. So how does this differ from: find . -name '*.c' .... > The apostrophes on in the open statement were there to clearly > denote that fact. The apostrophes are _not_ part of the value - and > are only there to prevent the Fortran compiler from incorrectly trying > to evaluate the string as a variable name or expression. The apostrophes in the find command were there to clearly denote that the string is "*.c", and are only there to prevent the shell from incorrectly trying to evaluate the string as a filename. > As I said > before, Fortran does evaluation in the the most meaningful context - the > caller. As I said before, the Shell does evaluation in the most meaningful context - the caller. > In a command language, the most meaningful context for argument > evaluation is in the recipient. In a command language, the most meaningful context for argument evaluation is the user, but in the absense of AI the caller is the best remaining choice. > In _neither_ language should the > parameter passing mechanism do the argument evaluation. In neither language does the parameter passing mechanism do the argument evaluation. > They are evaluated by the _shell_ NOT the _caller_. The shell is the caller. > The _shell_ does NOT do it only once, it globs > every time an argument gets passed to it - which in a UNIX environment > may be very often indeed. An argument is passed to the shell only once. If the arguments are ever passed unquoted that is a bug in the script, just as much as any other bug in any language... with the difference that you can fix it. -- Peter da Silva. `-_-' peter@ferranti.com +1 713 274 5180. 'U` "Have you hugged your wolf today?"