Skip to content

Unix: Emulation of ~ (tilde) expansion for native utilities is syntactically incomplete #20754

@mklement0

Description

@mklement0

Prerequisites

Steps to reproduce

Related:


/bin/echo ~/'foo'
/bin/echo ~/'foo bar'
/bin/echo ~/foo` bar
/bin/echo `~
/bin/echo ~'/'

Expected behavior

/Users/jdoe/foo
/Users/jdoe/foo bar
/Users/jdoe/foo bar
~
~/

Actual behavior

/Users/jdoe/foo
~/foo bar
~/foo bar
/Users/jdoe
/Users/jdoe

That is:

  • the form with a substring that contains spaces - either quoted or with an `-escaped space - unexpectedly didn't expand (expansion should occur as long as the ~/ prefix isn't quoted or escaped).

  • the escaped ~ unexpected expanded nonetheless (equivalent of echo \~ in Bash).

  • even though the / after ~ was quoted, (~'/'), expansion still unexpectedly occurred.

Error details

No response

Environment data

PowerShell 7.4.1 on Unix-like platforms.

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.OS-LinuxOS-macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions