I have a script that receives input from the user. One of the possible values I want to retrieve is the literal *
. It seems the shell is intercepting it and executing so that I'm getting a list of all the file names.
while read -p "Enter operand: " operandTwo
echo "Argument: $operandTwo"
echo "Argument: $(echo $operandTwo)"
[ $operandTwo != X ]
echo "Result: $?"
do...
This is the output:
Argument: *
Argument: File1 File2 File3
./script: line 20: [: too many arguments
Result: 2
Is the comparison being made here between File1 File2 File3
and X
? How do I make a comparison between *
and X
instead?