Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Almost expansion globbing #10361

Closed
rupert-t-strahovsky opened this issue Mar 10, 2024 · 4 comments
Closed

Almost expansion globbing #10361

rupert-t-strahovsky opened this issue Mar 10, 2024 · 4 comments
Labels

Comments

@rupert-t-strahovsky
Copy link

**
Fish version 3.3.1
Linux pop-os 6.6.6
Kitty terminal

So an interesting little problem here, it may, or may not, in fact be a bug, but it feels buggy and perhaps someone can put me on the right track either way:

Just attempting to glob ls with *, just playing around, getting a feel for fish, I notice this: If the directory has a single file ending with an "e" it is not picked up by "ls *e". Add a second file ending in "e", no problem.
For example:

touch charlie
ls *e
{Nothing}

touch charlee
ls *e
charlie
charlee
{As expected}

rm charlee
ls *e
{Again, nothing}

Now I have played around with a few letters, touch aa, ab, ac... etc, just seeing what happens, and assumed I am just globbing wrong. I probably am! But, I would love to know what is special about "e". I didn't go through the alphabet, and searched for other instances of people talking about this, but didn't find anything.
Any thoughts on this would be greatly appreciated. :)

~rts
**

@mqudsi
Copy link
Contributor

mqudsi commented Mar 10, 2024

Can you upgrade your fish installation and try again? I'm not reproducing this on my end, and 3.3.1 is rather old.

@rupert-t-strahovsky
Copy link
Author

rupert-t-strahovsky commented Mar 11, 2024 via email

@faho
Copy link
Member

faho commented Mar 11, 2024

This is, in fact, just ls behavior.

Try this:

ls aa/

This will print nothing. You're asking ls to show you the contents of the "aa/" directory, which is empty.

If you do

ls aa/ ba/

It will print "aa", and "ba", but more specifically it will print aa/: and ba/:. These are headings. ls tries to show the contents of both directories, and to disambiguate what is in which directory it prints a heading first.

If you want ls to not descend into the directories to show the contents, use ls -d.

@faho faho added the question label Mar 11, 2024
@rupert-t-strahovsky
Copy link
Author

Indeed! Thank you for the education. Like I said, just my not understanding very well.
We are all on a journey!
Thank you. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants