Re: Bug: temporary assignments vs shell function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rudolf Polzer wrote:

> So basically - when using an assignment for the duration of a shell command
> execution, an explicit subshell must be used in portable scripts, as
> interpretation of this construct differs among shells and thus cannot be relied
> on.

If "shell command execution" means "function call", then yes.

[...]
> exported() { :; }
>
> foo=bar exported
> sh -c 'echo $foo'

Ah, yuck.  On this machine:

 - dash does not export
 - zsh with "emulate sh" exports
 - ksh93 does not export
 - pdksh does not export
 - posh does not export
 - mksh exports
 - "bash -o posix" exports
 - busybox sh does not export

Fun.
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux