Reputation: 3305
When I just use java -Xxx *
, the program will get all things in the current path as the input.
How can I get just the *
string as an input?
Upvotes: 0
Views: 57
Reputation: 95684
That's not anything you're doing in Java; that's a behavior of bash filename expansions:
After word splitting [...] Bash scans each word for the characters ‘*’, ‘?’, and ‘[’. If one of these characters appears, then the word is regarded as a pattern, and replaced with an alphabetically sorted list of filenames matching the pattern (see Pattern Matching). If no matching filenames are found, and the shell option nullglob is disabled, the word is left unchanged.
As Jesper noted in the comments, you can avoid this behavior by quoting the *
character:
java -Xxx '*'
Or, as Ilya noted, you can escape it:
java -Xxx \*
Upvotes: 2