bash wildcard expansion length issue
So I've got a directory with quite a few thousand files (+27000) in it. They aren't named anything stupid; only numbers and _s.
I'm using the bash shell.
When I try and manipulate the files, starting with a *, I get an error:
ls: invalid option -- _
Try `ls --help' for more information.
I can use the wildcard in the middle of my query, just not at the start.
Same thing happens for cp, mv etc
I can get round it by:
ls -- *.gif
However, my question is: why on earth does this happen? I first thought maybe there was a character limit for the expansion... but I didn't see how the -- would help me.
Obviously google isn't particularly helpful when searching for '--'
Anyone have any ideas?