tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ PS1

Return Status for Exit ▻

assignment syntax

In article <8ej5n7$b4m$1@renpen.nelson.org>,
Bob Nelson  <bnelson@iname.com> wrote:
>2). If a Bourne-like shell were written to allow an assignment
>    such as...
>
>        var = 42

Like rc, for example.

>    ...what are some of the potential parsing problems (sans
>    backward compatibility) that would arise?

In Tom Duff's rc, and current versions of the Open Source rc, you have
to quote `=' whenever it doesn't mean shell assignment.

    ; sh configure --prefix=/opt/gnu
    syntax error

Versions that work are:

    ; sh configure '--prefix=/opt/gnu'

    ; sh configure --prefix^'='^/opt/gnu

and, thanks to free careting,

   ; sh configure --prefix'='/opt/gnu

The first (erroneous) form is not ambiguous, but it slightly complicates
the parser (and the manual page!) to accept it.  The Open Source rc may
do so in the near future.

Tim.
--
Tim Goodwin   | "If you don't know what closures are, you probably don't
Leicester, UK | want to know what closures are." -- Larry Wall

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: assignment syntax
Date: 3 May 2000 10:23:14 +0100
Message-ID: <8eor6o$lu0$1@ltpcg.star.le.ac.uk>
References: <8ej5n7$b4m$1@renpen.nelson.org>

△ comp.unix.shell △

◅ PS1

Return Status for Exit ▻