Passing an asterisk to a command-line program makes filenames appear in argv
The shell that you're running from is interpreting the asterisk as a file glob; it's replacing that character with the names of all the files in the current directory before passing the arguments to your program.
You need to escape the asterisk \*
in order for it to be passed along literally. This also applies to other characters that your shell interprets, such as quote marks "
and '
, backslashes, and ampersands.
You have 2 options
- Escape each single special symbol with a backslash (
\*
) or - Double-quote the argument (as in
"*"
).