tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: shell quoting
This is getting interesting.
> 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, 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).
Another point is that That GNU Monstrosity behaves the way I would (sorry)
have expected.
> and probably never will, there is no reason to do it
Depending on your mindset, it would follow POLA.
Home |
Main Index |
Thread Index |
Old Index