-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
Breaking-Changebreaking change that may affect usersbreaking change that may affect usersHacktoberfestPotential candidate to participate in HacktoberfestPotential candidate to participate in HacktoberfestIn-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Related: #4726
Steps to reproduce
New-Item 'foo[0].txt'
switch -File 'foo[0].txt' { default { 'hi' } }
Expected behavior
No output (the file is empty, there's nothing for switch -File
to iterate over).
Actual behavior
The following error occurs:
No files matching 'foo[0].txt' were found.
That is, filename foo[0].txt
was interpreted as a wildcard pattern, not a literal name.
With the current behavior, the workaround is to `
-escape the [
and ]
chars.
Note that even successfully resolving the wildcard expression ultimately fails if it resolves to multiple filenames, so the utility of interpretation-as-wildcard is questionable.
Environment data
PowerShell Core v6.2.0-preview.4 on macOS 10.14.2
PowerShell Core v6.2.0-preview.4 on Ubuntu 18.04.1 LTS
PowerShell Core v6.2.0-preview.4 on Microsoft Windows 10 Pro (64-bit; Version 1803, OS Build: 17134.471)
Windows PowerShell v5.1.17134.407 on Microsoft Windows 10 Pro (64-bit; Version 1803, OS Build: 17134.471)
Metadata
Metadata
Assignees
Labels
Breaking-Changebreaking change that may affect usersbreaking change that may affect usersHacktoberfestPotential candidate to participate in HacktoberfestPotential candidate to participate in HacktoberfestIn-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime