From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <368df355-19c9-4a30-93f0-f41f5f8e9943@email.android.com> References: <368df355-19c9-4a30-93f0-f41f5f8e9943@email.android.com> From: Giacomo Tesio Date: Tue, 16 May 2017 19:07:03 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary="001a113f6b806eb469054fa733ef" Subject: Re: [9fans] equality sign in Rc Topicbox-Message-UUID: bddd4de4-ead9-11e9-9d60-3106f5b1d025 --001a113f6b806eb469054fa733ef Content-Type: text/plain; charset="UTF-8" Tonight I've tried this little hack, but I do not have a comprehensive test suite (does any exists?) https://github.com/JehanneOS/jehanne/commit/003141901af25f0bb3556be40b7ff963f57ced32 I thought that there's no reason to mimic sh for this since if you need sh to run a script rc won't work anyway. So this is just a little syntactic sugar, that for the joy of sl is not compatible with sh, but imho it can also increases the readability of scripts. Indeed I agree with sl that expliitness is an advantage of the current quotation rules. The idea is to use a single $ to mark the end of variable declarations, so that what's left can't do assignments, and equality is always quoted. Here some examples: % a=1 echo b=$a rc: #d/0: token '=': syntax error % a=1 $ echo b=$a b=1 % $ eval prefix=$home/foo && echo $prefix /usr/glenda/foo % $ eval prefix=$home/foo; echo ./configure --prefix=$prefix rc: #d/0: token '=': syntax error % $ eval prefix=$home/foo; $ echo ./configure --prefix=$prefix ./configure --prefix=/usr/glenda/foo % inf=/dev/random out=/dev/null $ echo dd if=$inf of=$out dd if=/dev/random of=/dev/null The mini-syntax should extend till the end of a single command: ; & && and || should stop it. Note that it's the first time I use yacc, so probably there is a better way to code this and there are probably bugs. For example I was unable to make this works: % $ echo ./configure --prefix=`{cat /env/prefix} Giacomo 2017-05-16 17:59 GMT+02:00 Erik Quanstrom : > by doing it in the grammar, the redirection issue is avoided. > > - erik > > > On May 16, 2017 2:24 AM, Charles Forsyth > wrote: > > > On 15 May 2017 at 17:44, trebol wrote: > > > = is part of rc syntax, like {} and (), and it interprets it, not the > > > i'd forgotten about the = in >[2=1], so you'd need another exception ... > rc would interpret that, but then in [a-b=] it presumably wouldn't again... > > > --001a113f6b806eb469054fa733ef Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Tonight I've tried this little hac= k, but I do not have a comprehensive test suite (does any exists?)

<= a href=3D"https://github.com/JehanneOS/jehanne/commit/003141901af25f0bb3556= be40b7ff963f57ced32">https://github.com/JehanneOS/jehanne/commit/003141901a= f25f0bb3556be40b7ff963f57ced32

I thought that there's = no reason to mimic sh for this since if you need sh to run a script rc won&= #39;t work anyway.
So this is just a little syntactic sugar, that = for the joy of sl is not compatible with sh, but imho it can also increases= the readability of scripts. Indeed I agree with sl that expliitness is an = advantage of the current quotation rules.

The idea is to use a= single $ to mark the end of variable declarations, so that what's left= can't do assignments, and equality is always quoted.

Here= some examples:
% a=3D1 echo b=3D$a
rc: #d/0: token '=3D': syntax error
% a=3D1 $ echo b=3D$a
b=3D1
% $ eval prefix=3D$home/foo && echo $prefix
/usr/glenda/foo
% $ eval prefix=3D$home/foo; echo ./configure --prefix=3D$prefix
rc: #d/0: token '=3D': syntax error
% $ eval prefix=3D$home/foo; $ echo ./configure --prefix=3D$prefix
./configure --prefix=3D/usr/glenda/foo
% inf=3D/dev/random out=3D/dev/null $ echo dd if=3D$inf of=3D$out
dd if=3D/dev/random of=3D/dev/null

The mini-syntax should extend till the end of a single command: ; &am= p; && and || should stop it.

= Note that it's the first time I use yacc, so probably there is a better= way to code this and there are probably bugs.
For example I = was unable to make this works:
% $ echo ./configure --prefix=3D`{ca=
t /env/prefix}

Giacomo


2017-05-16 17:59 GMT+02:00 Erik Quanstrom <quanstr= o@quanstro.net>:
by doing it in the grammar, the redirection issue is avoided.

- erik

<= div class=3D"HOEnZb">

On May 16, 2017 2:24 AM, Charles Forsyth <charles.forsyth@gma= il.com> wrote:

On 15 May 2017 at 17:44, trebol <trebol55555@yandex.= ru> wrote:
> =3D is part of rc syntax, like {= } and (), and it interprets it, not the

i'd forgo= tten about the =3D in >[2=3D1], so you'd need another exception ...<= /div>
rc would interpret that, but then in [a-b=3D] it presumably would= n't again...


--001a113f6b806eb469054fa733ef--