-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Backtick-escaping doesn't work for suppressing native tilde and pathname expansions #27116
Copy link
Copy link
Open
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
The promise of `-escaping is to treat whatever character follows verbatim, i.e. to suppress the usual interpretation of potential metacharacters.
While this works with true metacharacters such as $ and @, it unexpectedly doesn't work with unquoted instances of ~, and - on Unix-like platforms only - *, and ? in the context of tilde and pathname expansion for native (external) programs.
# On Unix; applies analogously on Windows (with respect to '~' only) in v7.6+
printf '~'
printf `~Expected behavior
~
~Actual behavior
~
/home/jdoe That is, `-escaping wasn't effective in suppressing the tilde expansion.
Contrast this with printf `@, which works as expected.
Error details
Environment data
PowerShell Core v7.6.0Visuals
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.