[Tcsh] "Readable" Unicode in setenv

Kimmo Suominen kim at netbsd.org
Fri Dec 10 12:41:11 UTC 2021


Ah, I think I figured it out: without the :q modifier, the argument to
echo is globbed, and thus the curly braces are gone.

+ Kimmo

On Fri, 10 Dec 2021 at 14:36, Kimmo Suominen <kim at netbsd.org> wrote:
>
> On Fri, 10 Dec 2021 at 13:57, H.Merijn Brand <tcsh at tux.freedom.nl> wrote:
> > % setenv EURO "\x{20ac}" ; echo $EURO
> >  ac
> >
> > If not a bug, could you explain why?
>
> Hmm... interesting. So on a NetBSD host:
>
> equinoxe:~> setenv EURO "\x{20ac}" ; echo $EURO
> \x20ac
> equinoxe:~> env | grep -i euro
> EURO=\x{20ac}
> equinoxe:~> echo "\x{20ac}"
> \x{20ac}
> equinoxe:~> set echo_style=both
> equinoxe:~> echo "\x{20ac}"
>> equinoxe:~> echo $EURO
>  ac
> equinoxe:~> echo $EURO:q
>> equinoxe:~> set echo_style=bsd
> equinoxe:~> echo $EURO
> \x20ac
> equinoxe:~> echo $EURO:q
> \x{20ac}
> equinoxe:~>
>
> So it has something to do with expanding the value. I don't think I
> changed anything about that. I don't know why the braces get removed
> without the :q modifier.
>
> But instead of storing the escape sequence in the ECHO environment
> variable, I would suggest storing the actual character. This way you
> can even skip ensuring echo_style is what you need.
>
> equinoxe:~> setenv EURO $'\x{20ac}'
> equinoxe:~> echo $EURO
>> equinoxe:~> env | grep -i euro
> EURO=€
> equinoxe:~>
>
> Kind regards,
> + Kimmo


More information about the Tcsh mailing list