tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: shell quoting
Date: Wed, 9 Sep 2026 23:59:18 +0000 (UTC)
From: RVP <rvp%SDF.ORG@localhost>
Message-ID: <5e568e6a-c0bb-3453-172f-cf4065906e36%SDF.ORG@localhost>
| Doubles my resolve to _always_ do `local v="$1"' now.
If you were to write it as
local "v=$1"
instead, you disable the "declaration utility" nonsense for those
shells which have fallen into that rat-hole, and will get consistent
results everywhere (as a quoted name doesn't meet the requirements to
be a var-assign, but by the time "local" sees the result, the two are
identical.)
The other way to defeat it is
local=local
$local v="$1"
which also inhibits the parser's ability to detect that this is one
of the commands which might get special handling.
Probably better though (for most uses) is just to use
local v; v=$1
where, whether you quote the "$1" or not makes no difference at all.
And of course, the same applies for all the commands that added this
strange persisting variable assignment as an arg mechanism (export,
readonly, & declare or typeset in shells that have those, etc), not just
local.
kre
Home |
Main Index |
Thread Index |
Old Index