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
{{ message }}
Repository navigation
Native globbing: Automatic globbing for native commands doesn't work with backtick-escaped spaces #10683
When calling external programs (native programs) on Unix-like platforms, wildcard patterns that you want automatic globbing applied to (as in Bash, for instance) must be unquoted, i.e. they must neither be enclosed in single quotes nor in double quotes.
Therefore, if you want globbing to be applied to a wildcard pattern that has spaces, for instance, you need to individually escape the space, namely as `
However, the automatic globbing mechanism currently doesn't recognize that and doesn't expand such patterns.
Steps to reproduce
On Linux (native globbing is currently fundamentally broken on macOS, and isn't applied on Windows)
Push-Location temp:/
touch 'a b.txt'/bin/echo a`*| Should -Be 'a b.txt'Remove-Item'a b.txt'Pop-Location
Expected behavior
The test should succeed.
Actual behavior
The test fails, because the pattern is not expanded ('a *' is echoed).
It's not a duplicate, because the linked issue relates to resolving PS-drive-based paths to native paths, (which would also apply to Windows), whereas this issue is related to the (Unix-only) native-globbing feature.
changed the title [-]Automatic globbing for native commands doesn't work with backtick-escaped spaces[/-][+]Native globbing: Automatic globbing for native commands doesn't work with backtick-escaped spaces[/+]on Sep 6, 2022
Workaround is to wrap any globbing with (Get-ChildItem ...). This is also a problem on Windows using utilities ported from Unix which expect globbing to be expanded by shell. Examples:
vim *.txt # bash: opens all txt files bash, pwsh: opens file '*.txt'
vim (Get-ChildItem*.txt) # bash and pwsh: opens all txt files
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
Activity
iSazonov commentedon Oct 7, 2019
Is there a workaround?
mklement0 commentedon Oct 7, 2019
Ilya (@iSazonov): Not in terms of native globbing, as far as I can tell, but you can do the following:
iSazonov commentedon Oct 7, 2019
It seems a dup #10675.
mklement0 commentedon Oct 7, 2019
It's not a duplicate, because the linked issue relates to resolving PS-drive-based paths to native paths, (which would also apply to Windows), whereas this issue is related to the (Unix-only) native-globbing feature.
iSazonov commentedon Oct 8, 2019
Really the resolving is executed by the same LocalGlobbig code. So technically it is one issue.
mklement0 commentedon Oct 8, 2019
I see: it happens to be technically related rather than a duplicate.
[-]Automatic globbing for native commands doesn't work with backtick-escaped spaces[/-][+]Native globbing: Automatic globbing for native commands doesn't work with backtick-escaped spaces[/+]dkaszews commentedon Sep 6, 2022
Workaround is to wrap any globbing with
(Get-ChildItem ...). This is also a problem on Windows using utilities ported from Unix which expect globbing to be expanded by shell. Examples:dkaszews commentedon Nov 28, 2023
Steven Bucher (@StevenBucher98) Steve Lee (@SteveL-MSFT) Ryan Yates (@kilasuit) Please reopen
6 remaining items
dkaszews commentedon Nov 25, 2024
Repro on 7.4.6
dkaszews commentedon May 25, 2025
Repro on 7.5.1
microsoft-github-policy-service commentedon Nov 22, 2025
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
xtqqczze commentedon Dec 2, 2025
Steven Bucher (@StevenBucher98) please reopen
microsoft-github-policy-service commentedon Jun 1, 2026
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.