Newsgroups: comp.sys.mac.programmer
Path: utzoo!censor!geac!alias!barney!rae
From: Reid Ellis <rae@gpu.utcs.toronto.edu>
Subject: Re: MPW & spaces in pathnames
Message-ID: <rae.663106849@barney>
Sender: Reid Ellis <rae%alias@csri.toronto.edu>
Reply-To: Reid Ellis <rae@gpu.utcs.toronto.edu>
Organization: Alias Research, Inc. Toronto ON Canada
References: <1990Dec27.173958.18413@CAM.ORG> <1990Dec29.221358.18317@chinet.chi.il.us> <14457@hoptoad.uucp>
Date:  5 Jan 91 20:20:49 GMT

Laird J. Heal <laird@chinet.chi.il.us> writes:
>Wherever there is a file name, put double-quotes around anything that
>is not wild-carded (? or option-x) and almost all of your troubles
>will be solved.

Tim Maroney <tim@hoptoad.uucp> writes:
>Building file names out of arguments and variable expansions, and
>storing them in variables or aliases, makes the problem much more
>complicated.

One problem along these lines is storing filenames in a file,
separated by newlines.  Given such a file, it is difficult to assign
the file names to a variable, properly quoted.  That is to say, given
a file such as:

	File Number 1
	Second File

I want to set a variable as follows:

	set foo '"File Number 1" "Second File"'

The obvious doesn't work:

	set foo "`cat filename`"

since files have spaces in them.  Later in the script, I want to be
able to say:

	for file in {foo} ...

Recently, I have started using StreamEdit as a solution to the
problem, be having it quote each line in the file.  Thus my assignment
is now:

	set foo `streamedit -s script.sed file`

Not quite good enough, in my view.

					Reid
--
Reid Ellis  176 Brookbanks Drive, Toronto ON, M3A 2T5 Canada
rae@gpu.utcs.toronto.edu      ||  rae%alias@csri.toronto.edu
CDA0610@applelink.apple.com   ||             +1 416 446 1644
