tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: shell quoting
On Wed, Sep 09, 2026 at 17:28:56 +0200, Edgar Fuß wrote:
> > In the 2024 edition of POSIX, they invented something called a
> > "declaration utility" in which arguments that look like assignments
> > (an unquoted name, '=', and then any remainder of the word) are
> > parsed, and evaluated, as if they were assignment statements).
>
> While this adds yet another attribute to the
> built-in/implemented-as-built-in/ special-built-in zoo of utilities,
> I tend to like the concept.
>
> > Our shell doesn't do that, that is, we have zero declaration utilities
>
> So for the $1="a b" case, this makes
>
> foo=$1
>
> behave diffently from
>
> local foo=$1
> and
> export foo=$1
>
> Of course one could argue (and I would expect KRE to argue that way)
> that yes, that's the way sh works, and everyone In The Know would
> expect this,
Yes, that's a very old footgun. IIRC, old shell didn't do
`export VAR=value`, only `export VAR`. And then `local` inherited the
same problem whet it was introduced.
> and
>
> assign foo=$1
>
> would also behave that way no matter how "assign" is defined (well,
> I would't bet KRE couldn't make up a definition that makes it work
> the assignment way, but I myself can't).
I guess that's why they are inrtoducing this "declaration utility"
thing, whatever that is...
-uwe
Home |
Main Index |
Thread Index |
Old Index