Hi Jilles, thanks for your reply. Indeed now I remember having read
somewhere that you couldn't portably rely on assignments after "local"
to suppress word expansion in the same way that ordinary assignments do.
I had forgotten that. I hope shell implementations evolve towards more
consistency about this. In the meantime, it's easy enough to get
portable behavior if you remember the issue.
On another note, I was reading in this mailing list about dash's
treatment of:
FOO=value shell_function $args
printf "%s\n" "$FOO" # prints 'value'
The other discussion points out that this surprising behavior is in fact
mandated by POSIX.
I notice however in the dash.1 manpage distributed with finnix 103, the
following:
When a shell function is executed, all of the shell positional
parameters
(except $0, which remains unchanged) are set to the arguments of
the
shell function. The variables which are explicitly placed in the
envi-
ronment of the command (by placing assignments to them before the
func-
tion name) ***are made local to the function and are set to the
values
given.*** Then the command given in the function definition is
executed.
The positional parameters are restored to their original values
when the
command completes. This all occurs within the current shell.
Presumably this manpage should be updated to track the current behavior
of dash. I'm not sure whether it comes from the dash source distro, or
was added in by the finnix maintainers.
--
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html