On 17/04/2020 17:37, lunkov@xxxxxxxxx wrote:
Hello! I encountered a script execution error using dash. Other shells
execute this script without error. Perhaps there is an error in dash.
Please execute my script in dash and in bash, for example.
-------------------------------------------------------------------------------------------------
[...]
local F=`echo "${i}" | grep "${PATTERN}"` # local
Hi,
The latest release version of dash does not support assignment syntax in
command arguments. Assignment syntax is special in that it prevents
field splitting. A shorter example is
x="1 y=2"
export x=$x
echo y=$y
This prints y=2 in the latest release version, but prints y= in other
shells (unless you had previously set y yourself): without special
assignment syntax, x=$x is split into x=1 and y=2 before it is passed to
the export command, but with special assignment syntax x=$x is preserved
as a single word.
You can work around this by adding quoting:
local F="`...`"
The current git version of dash does support assignment syntax in
command arguments (like other shells, only for specific commands) and
accepts your script without modifications.
Cheers,
Harald van Dijk