You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Unix, barewords passed as arguments to external (native) programs are subject to globbing (filename expansion), if they contain * or ?, for compatibility with native Unix shells.
In direct invocation, the way to avoid this is to quote the bareword, e.g. '*'
However - and this constitutes the bug - when splatting, the globbing cannot be prevented:
# On Unix-like platforms./bin/echo @( '*' )
Note that using embedded quoting (e.g., @('"*"')) is not an option, because it becomes part of the argument.
Expected behavior
* should print verbatim.
Note:
The above assumes that '*' should not be treated like a bareword in the context of splatting, which in turn implies that you fundamentally cannot specify barewords that way, and would have to use something like @((Get-Item * -Name)) to manually perform the desired globbing.
This strikes me as an acceptable trade-off and much preferable to the alternative: defaulting to interpretation as barewords, with a yet-to-be-devised opt-out method.
Actual behavior
The names of the files and subdirectories in the current directory print, because native globbing was applied.
Error details
No response
Environment data
PowerShell 7.5.0-preview.3 on Unix-like platforms.
Prerequisites
Steps to reproduce
Note: This has been reported before, but not as a dedicated issue:
On Unix, barewords passed as arguments to external (native) programs are subject to globbing (filename expansion), if they contain
*or?, for compatibility with native Unix shells.In direct invocation, the way to avoid this is to quote the bareword, e.g.
'*'However - and this constitutes the bug - when splatting, the globbing cannot be prevented:
Note that using embedded quoting (e.g.,
@('"*"')) is not an option, because it becomes part of the argument.Expected behavior
*should print verbatim.Note:
The above assumes that
'*'should not be treated like a bareword in the context of splatting, which in turn implies that you fundamentally cannot specify barewords that way, and would have to use something like@((Get-Item * -Name))to manually perform the desired globbing.This strikes me as an acceptable trade-off and much preferable to the alternative: defaulting to interpretation as barewords, with a yet-to-be-devised opt-out method.
Actual behavior
The names of the files and subdirectories in the current directory print, because native globbing was applied.
Error details
No response
Environment data
Visuals
No response