zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: ZyX <kp-pav@yandex.ru>
Cc: Peter Stephenson <p.w.stephenson@ntlworld.com>,
	"zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [BUG] Unicode variables can be exported and are exported metafied
Date: Sat, 20 Dec 2014 10:08:02 +0000	[thread overview]
Message-ID: <20141220100802.GA6223@chaz.gmail.com> (raw)
In-Reply-To: <1136161419067647@web17g.yandex.ru>

2014-12-20 12:27:27 +0300, ZyX:
[...]
> > (Or else, you could do like rc and allow anything allowed in env
> > vars (rc allows any name as long as it's not empty and doesn't
> > contain `=`).
> 
> `абв=1 rcsh -c 'echo $абв'` emits “line 1: syntax error near
> (decimal -48)”. Is it the difference between “A
> reimplementation of the Plan 9 shell”
> (http://rc-shell.slackmatic.org/) version 1.7.2 that can be
> found in the main portage tree and the original Plan9 shell?
> Or maybe I should simply use different syntax (rcsh -c 'echo
> $PATH' works though)?
> 
> --
> 
> Found this syntax: `абв=1 rcsh -c 'echo $(абв)'` echoes 1. But
> `абв=1 rcsh -c 'env; абв=10; env; echo $(абв)'` shows that
> rcsh removes `абв` from the environment and places variable
> named `__d0__b0__d0__b1__d0__b2` there instead.
[...]

Sorry,

I should have tried. I suppose rc being from the 80s uses the
8th bit for parsing/tokening like other shells from that time as
well.

But the idea remains. In `rc`, you can do:

'my var
(with all sorts of characters)' = whatever
echo $'my var
(with all sorts of characters)'

And assuming it was extended to 8bit bytes, that means you can
have code that works regarless of the locale of the user since
all variable names are allowed. That also simplifies interaction
with env vars (though you still have problems with special
parameters like $1, $*...).

That would mean changing zsh syntax though and I don't think
it's really worth it.

> By the way, `env` allows empty name.

Yes, and you can pass env strings to execve() without `=` in
them.

-- 
Stephane


      reply	other threads:[~2014-12-20 10:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 18:19 ZyX
2014-12-18 19:29 ` Peter Stephenson
2014-12-18 19:47   ` Peter Stephenson
2014-12-18 19:58     ` Bart Schaefer
2014-12-18 20:09       ` Peter Stephenson
     [not found]       ` <54933513.6010501@case.edu>
2014-12-18 20:20         ` Fwd: " Bart Schaefer
2014-12-19  9:29       ` Christoph (Stucki) von Stuckrad
2014-12-19 18:17       ` Christoph (Stucki) von Stuckrad
2014-12-19 20:13         ` Павлов Николай Александрович
2014-12-19 21:21         ` Peter Stephenson
2014-12-19 22:44           ` ZyX
2014-12-20  0:13             ` Stephane Chazelas
2014-12-20  9:27               ` ZyX
2014-12-20 10:08                 ` Stephane Chazelas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141220100802.GA6223@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=kp-pav@yandex.ru \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).