How do I escape a wildcard expansion in a variable name?
CP="lib/*"
COMMAND="java $VARIABLES -cp $CP SomeClass"
echo $COMMAND
Echoing the command always causes wildcard expansion.
How do I escape a wildcard expansion in a variable name?
CP="lib/*"
COMMAND="java $VARIABLES -cp $CP SomeClass"
echo $COMMAND
Echoing the command always causes wildcard expansion.
echo "$COMMAND"
Using quotes prevents the glob from being expanded.
By the way, see "I'm trying to put a command in a variable, but the complex cases always fail!"
"I'm trying to put a command in a variable, but the complex cases always fail!"
Use an array instead.
© 2022 - 2024 — McMap. All rights reserved.