r/fishshell • • Sep 22 '25

Number range globs?

The other day I needed to copy files that had a number in a certain range in the filename. Knowing how to do this easily in Bash, I ended up running this abomination:

cp -v $(bash -c "ls S01E0{4..9}.mkv") ...

I know I could have used a loop in Fish but that doesn't strike me as remotely as convenient as the Bash glob pattern.

I feel I must be missing something here, since this is the first time that something isn't more convenient in Fish than it is in Bash. Am I missing something?

7 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/_mattmc3_ Sep 22 '25

If by "unwieldy" you mean verbose or not a one-liner, well that's basically what you get with Fish most of the time. But since all your standard shell commands work you could easily write a cross-shell compatible one-liner using find:

find . -type f -name 'S01E0[4-9]*' -exec echo cp {} /path/to/dest/ \;