Announcement

Collapse
No announcement yet.

bash globbing: ls not accepting regex properly?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] bash globbing: ls not accepting regex properly?

    Weird, ls isn't accepting regex properly

    Code:
    ls *.pdf
    ls: invalid option -- '9'
    Can't escape it either
    Code:
    ls \*.pdf
    ls: cannot access '*.pdf': No such file or directory​
    Something is broken with bash globbing.

    works with other file types

    ls *.txt
    ls *.jpg

    just ls *.pdf doesn't work? How does that make any sense? (And yes there are pdfs in the directory)

    Checking, it works in other directories -- why would it not work in my Downloads directory but everywhre else?

    Workaround:
    Code:
    ls ./*.pdf
    or
    Code:
    ls -- *.pdf



    EDIT: Figured it out. There's one pdf in there with a filename starting with a "-" so ls is interpreting that as an option
    Totally my fault for not seeing it.

    see here: https://superuser.com/questions/1300...invalid-option







    ​​
    Last edited by devnulljp; Nov 21, 2024, 08:08 PM.
    Dont pretend you havent noticed my cardboard box, Julia, because I know you have!
Working...
X