Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-crg!ames!cit-vax!news
From: news@cit-vax.Caltech.Edu (Usenet netnews)
Newsgroups: comp.sys.amiga
Subject: Re: Pattern Matching & documentation
Message-ID: <1366@cit-vax.Caltech.Edu>
Date: Wed, 17-Dec-86 21:22:45 EST
Article-I.D.: cit-vax.1366
Posted: Wed Dec 17 21:22:45 1986
Date-Received: Thu, 18-Dec-86 05:44:04 EST
References: <954@blia.BLI.COM> <1731@jade.BERKELEY.EDU>
Reply-To: tim@tomcat.UUCP (Tim Kay)
Organization: California Institute of Technology
Lines: 68

Organization : California Institute of Technology
Keywords: shell scripts
From: tim@tomcat.Caltech.Edu (Tim Kay)
Path: tomcat!tim

mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) writes:
>vanam@pttesac.UUCP (-Root Admin-) writes:
>>mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) writes:
>>>cc1@locus.ucla.edu (Michael Gersten) writes:
>>>>As for shell scripts, I'm not sure I understand the question/complaint.
>>>Consider a shell script:
>>>	for i in $*
>>>	do
>>>		echo $i
>>>	done
>>>which acts like echo, but puts each word on a seperate line. Now, try
>>>convincing it to echo a "*". Notice that your quoting mechanisms don't
>>>work right.
>>
>>Maybe I don't understand exactly what you're trying to do, but it seems
>>to work just fine here (I'm running on Sys V release 2 unix) if I type
>>'echo "*"', the system echoes an asterisk.  All I have to do is quote it.
>
>You're right, you don't understand what I'm trying to do. Watch:
>  [demonstration deleted]

But, if you write the lecho shell script as

	for i in "$@"
	  do
	  echo "$i"
	  done

it does the following
	tomcat% lecho

	tomcat% lecho hello, world
	hello,
	world
	tomcat% lecho *
	3d
	640k
	int.pas
	lecho
	printer
	shell
	t.pas
	tex
	typescript
	wow
	tomcat% lecho \*
	*
	tomcat% lecho "*"
	*

So, the quoting mechanism under Unix *works*.  It isn't all that
difficult to prove (literally) that you can do anything you want.

NEVERTHELESS.  I don't like nor remember nor understand all the
features of the quoting mechanism under Unix, and I think that
each program should expand its own arguments.

A shell should be kept very small.

Timothy L. Kay				tim@csvax.caltech.edu
Department of Computer Science
Caltech, 256-80
Pasadena, CA  91125