Skip to content

ls does not expand * when run from cmd or PowerShell on Windows #1019

@samuel-k-hu

Description

@samuel-k-hu

Hi,

I recently dropped Cygwin and switched to PerlPowerTools. I found that it fits my needs very well :-)

I was especially surprised by how well tools like find and grep work. Overall, I don’t really feel that anything is missing.

Using PerlPowerTools in daily work makes it easier to notice certain issues. I just discovered that ls cannot handle wildcards.

Below is the error message when running it under cmd:

ls: can't access '*.pl': Invalid argument

In PowerShell, ls is mapped to Get-ChildItem. To reproduce this issue, the alias must be removed first:

Remove-Alias ls

This problem does not exist in Cygwin. I assume this is because bash expands wildcards before invoking ls, whereas in cmd and PowerShell the wildcard string is passed to ls verbatim.

I suspect that other tools may have similar potential issues as well, but ls makes this problem particularly visible, since I frequently use commands like ls *.pl.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions