On 2008-01-04, at 14:33, Aaron Crane wrote:
It's not necessary to quote a variable on the right-hand side of an
assignment:

  $ f() { local x=$1; echo "[$x]"; }
  $ f 'foo bar'
  [foo bar]

I'm not sure I entirely approve of that, because it seems to make the syntax less regular, and I'll continue to quote them in my own code... but 'declare -f "$old"' and 'unset -f "$old"' seem no-brainers.

Also, I decided I didn't care about any brokenness resulting from
however the user might have managed to persuade the shell to create a
function with a non-identifier-syntax name.

I'm more coming from the point of view of never writing scripts that expose a quoting attack, even if you never think they should ever be exposed to untrusted strings.

Reply via email to