${PARAM[-=]'echo word'} follow up

Kevin Braunsdorf ksb at s.cc.purdue.edu
Sun Jan 15 10:30:20 AEST 1989


I wrote:
>I want an environment variable `ROFF' to be an nroff/troff/DITroff
>command (if set).  I want the default to be `nroff -man' so I try:
>	${ROFF-'nroff -man'} $file
>
>to which the shell replys
>	sh: nroff -man: not found
>
>clever me tries
>	${ROFF='nroff -man'} $file
>
>and it works!  But *only* on 1/2 of the machines I try it on.
> .... [Which is correct?] ...

This is a summary of the replies I have:


Some people told me `what the problem was'; maybe I did not make
myself clear.  I know about quoting, what I am trying to discover
is `how many times *should* the word after the `=' be evaluated?'


Chris Torek tells me that it is worse than I thought, under some shells
the space still is a meta-space even after the assignement, so:

	$ : ${ROFF='nroff -man'}
	$ $ROFF $file
	sh: nroff -man: not found


Then I looked at what ksh does.  It does 2 evals and gets no meta-
space in Chris's case (above).


I conclude, then, that the word after the `=' *should* be evaluated
twice.  (And Chris's example above should work.)

Which only means I have a list of broken shells!

--
kayessbee, Kevin Braunsdorf, ksb at j.cc.purdue.edu, pur-ee!ksb, PUCC UNIX Group



More information about the Comp.unix.wizards mailing list