Skip to content

Precommand assignments after env should be allowed to be quoted #743

@danielshahaf

Description

@danielshahaf
Member

See #627 (comment) and the following comments.

Activity

danielshahaf

danielshahaf commented on Jun 6, 2020

@danielshahaf
MemberAuthor

For greppability purposes, quoting @phy1729 analysis from there:

sudo env "PATH=$PATH"
First word is sudo which is a known precommand, so next word will be parsed as a command.
Next word is env which is a known precommand, so next word will be parsed as a command.
Next word is "PATH=$PATH". There's a bug in z-sy-h that when parsing a command ($this_word == *:start:*) an assignment is recognized even if it's no long the true start of a command (i.e. after a precommand), so command foo=bar echo baz parses foo=bar as an assignment and echo as the command even though command will error as foo=bar isn't a command. However in the case of env this mostly is desired. env being a command allows for quoted arguments just like any other, but assignments at the beginning of a command must not be quoted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @danielshahaf

        Issue actions

          Precommand assignments after `env` should be allowed to be quoted · Issue #743 · zsh-users/zsh-syntax-highlighting