-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Documentation Issue
While --%, the stop-parsing symbol technically works on Unix-like platforms (macOS, Linux), its Windows-focused behavior makes it near-useless there, which should be clearly stated.
Context of the issue
-
URL to the article (Docs or GitHub URL): https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parsing
-
Issue affects the following content (check all that apply):
Cmdlet reference & about_ topics
- Version 7 content
- Version 6 content
- Version 5.1 content
- Version 5.0 content
- Version 4.0 content
- Version 3.0 content
Conceptual articles
- Fundamental conceptual articles
- Script sample articles
- DSC articles
- Gallery articles
- JEA articles
- WMF articles
- SDK articles
-
Is the issue specific to a platform (Y/N - Win/macOS/Linux): N
Detailed description of the issue
The idea behind --% was to allow command lines designed for cmd.exe to work in PowerShell.
The generalization of this idea would be to make --% work similar to /bin/sh (the default, POSIX-like shell) on Unix-like platforms; however, in PowerShell/PowerShell#3733 it was decided not to attempt that, so --%' s behavior remains Windows-focused.
As such, it has little value on Unix-like platforms, and that should be noted in about_Parsing.
Specifically, the following aspects make the behavior a poor fit on Unix:
- single quotes aren't supported, even though
/bin/shsupports them - see Stop-parsing symbol on Unix-like platform doesn't support single-quoted arguments PowerShell/PowerShell#10831 (since closed in favor of this issue). - the only way to reference environment variable is cmd.exe-style (
%var%), whereas/bin/shuses$varsyntax. /bin/shperforms automatic globbing (wildcard expansion) on arguments such as*.txt, which--%doesn't do.- More generally,
/bin/shperforms a range of shell expansions that--%doesn't perform.