First the global answer: filename expansion globbing
. Read up on it
In more detail: If you use any
commandline parameter without quotes, bash will try to 'fileglob' it to a filename. If it can't find it as a filename, then it fill pass it as a literal to the command in question.
So an 'echo *' will actually display all filenames in your current directory and an 'echo [abc]*' will display either all filenames starting with an a, b or c in the current directory, or if there are none the literal string '[abc]*'
Can you guess what happens with the command 'ls [abc]*' ? Hint: it's not 'ls' that does the fileglobbing!
Doing an 'echo "*"' will not
do fileglobbing and just echo a literal '*'.
So you can either quote all commandline parameters: 'echo "I am the *best*"', or turn off fileglobbing with a 'set -f' (turn it back on with 'set +f')
Ohw yeah, putting letters between square brackets means: take one of the following characters.
If you're breaking it up with a space, it's not a legal range anymore (unless the space is escaped) so it's taken as a literal again