dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harald van Dijk <harald@gigawatt.nl>
To: "lunkov@gmail.com" <lunkov@gmail.com>, dash@vger.kernel.org
Subject: Re: Maybe a mistake
Date: Fri, 17 Apr 2020 17:51:01 +0100	[thread overview]
Message-ID: <617c7c35-e605-6042-a11c-ee8541979079@gigawatt.nl> (raw)
In-Reply-To: <CAGQt5nnH+ZBXbKreCFyEzqed8Yq_P6YqT0ideKVzd7OU_4bTAg@mail.gmail.com>

On 17/04/2020 17:37, lunkov@gmail.com 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

      reply	other threads:[~2020-04-17 16:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 16:37 Maybe a mistake lunkov
2020-04-17 16:51 ` Harald van Dijk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=617c7c35-e605-6042-a11c-ee8541979079@gigawatt.nl \
    --to=harald@gigawatt.nl \
    --cc=dash@vger.kernel.org \
    --cc=lunkov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).