On 13 May 2017 at 13:36, trebol <trebol55...@yandex.ru> wrote:

> You can force rc to setting a variable only if = is surrounded by spaces,
> like in sh, but then you'll have a lot of problems in plan9/p9p.


That isn't sh's rule. x=y is fine as an assignment without spaces.
Shell/environment variable assignments appear only before a command, as in
rc,
and otherwise the text gets passed to the command. As I understood Bourne's
talk about sh, originally it was intended to support named
parameters, as in another command interpreter he'd used, and in cmd x=y
b=x, the shell not the command would parse the x=y and b=x
and pass the result to the command separately from the positional
parameters of argv. That was modified to be allowed only at the start,
because of an existing command 'dd', which unusually used x=y instead of
the usual -x y, partly as humour, since IBM JCL then and now
had a DD statement with name=value syntax (//STEP5.INPUT DD
DSNAME=FRUITBAT,DISP=SHR)
``The maximum number of DD statements per job step is 3273''. Plan 9's dd's
syntax changed to the -x y style.

In rc, the unquoted = causes a syntax error because nothing in syn.y allows
'=' after the start of <simple>.
Perhaps instead of passing it to the command as in Unix, rc could do what
sh originally intended, and lift named parameters
into the environment wherever they appear in a command.

Reply via email to