Skip to content

Unable to pass strings containing quotes to commands #6154

@ViridiFox

Description

@ViridiFox

Describe the bug

Quotes contained in a string disappear, which causes the passed string to be parsed incorrectly by a shell to which the string gets passed internally e.g. ['bash', '-c', 'echo', 'a'] instead of ['bash', '-c', 'echo a'].

How to reproduce

~
nu ❯ "bash -c 'echo a'"
bash -c 'echo a'

~
nu ❯ ^echo "bash -c 'echo a'" # problematic case
bash -c echo a

in bash:

~
bsh ❯ echo "bash -c 'echo a'"
bash -c 'echo a'

Expected behavior

for the commands' output to be the same

Screenshots

No response

Configuration

key value
version 0.66.1
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.64.0-nightly (4d6d601c8 2022-07-26)
rust_channel nightly-x86_64-unknown-linux-gnu
cargo_version cargo 1.64.0-nightly (d8d30a753 2022-07-19)
pkg_version 0.66.1
build_time 2022-07-27 16:34:32 +00:00
build_rust_channel release
features default, trash, which, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions