Skip to content

Need to escape $ for externals #1439

Closed

Description

@thegedge

Describe the bug
When running an external, $ is always evaluated as an env var, so it must always be escaped. This perhaps applies to other special characters for the shell under which we execute externals.

To Reproduce
Compare

$ ^echo yes | awk '{ print $0 }'

to

$ ^echo yes | awk '{ print \$0 }'
yes

Expected behavior
I would expect one of two possible behaviours:

  1. Since nu doesn't do environment variables at the moment, perhaps escaping would be unnecessary.
  2. Similar to other shells, "..." would interpolate env vars and '...' would not.

Configuration (please complete the following information):

  • OS: OSX
  • Version 10.15.3

Activity

  1. added
    category:bug
    polish
    A:external-commands
    on Feb 29, 2020
  2. added
    A:parser
    on Apr 21, 2020
  3. thegedge commented on Apr 21, 2020

    @thegedge
    ContributorAuthor

    So this looks to be a parser problem. When I output the args for the first one:

    awk \"{ print $0 }\"
    

    Seems like the single quotes are being converted to double quotes. We should probably maintain quoting.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:external-commandsA:parsercategory:bugpolish

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions