Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] Unicode variables can be exported and are exported metafied



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



Messages sorted by: Reverse Date, Date, Thread, Author