Skip to content

History expansion (!!) triggers inside backtick-quoted strings, corrupting file paths #1056

Description

@seccentral

Bug report form

  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.

Describe the bug

When a filename contains !!, Nushell performs history expansion on it even when the name is wrapped in backticks. Since backticks are a quoting form, no history expansion should occur inside them. The result is that the token is silently rewritten to a different path before the command executes, making the real file impossible to reference by name.

Bug outcome:
On Enter, the command line is rewritten to ls test & test ls test.txt — !! has been expanded to the first token of the previous command (ls). The backticks did not prevent the expansion. The command then fails or targets the wrong path, and the actual file on disk cannot be addressed via its real name.

How to reproduce

  1. Create a file whose name contains !!, e.g. test & test !! test.txt.
  2. Run any command, e.g. ls, so that history has at least one entry.
  3. Type: ls test & test !! test.txt and press Enter.

Expected behavior

The backtick-quoted string is passed through literally. ls (or rm, open, etc.) operates on the file test & test !! test.txt. This matches how Bash and Zsh handle history expansion inside single quotes.

Configuration

version │ 0.112.2
major │ 0
minor │ 112
patch │ 2
branch │
commit_hash │ d80ee8c19e07a8058e50a30a4205d3e97068f585
build_os │ windows-x86_64
build_target │ x86_64-pc-windows-msvc
rust_version │ rustc 1.92.0 (ded5c06cf 2025-12-08)
rust_channel │ 1.92.0-x86_64-pc-windows-msvc
cargo_version │ cargo 1.92.0 (344c4567c 2025-10-21)
build_time │ 2026-04-15 21:31:35 +00:00
build_rust_channel │ release
allocator │ standard
features │ default, mcp, network, plugin, rustls-tls, sqlite, trash-support
installed_plugins │
experimental_options │ example=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=false, native-clip=false, cell-path-types=false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions