Reputation: 1417
I'm parsing the result of a curl call into a variable this way:
result=$(curl some curl parameters)
I'm then making a check:
if [ $result != "job completed" ];
then printf "ok"
fi
but I'm getting the following error:
[: too many arguments
any idea why?
Upvotes: 0
Views: 40
Reputation: 881523
It's almost certainly because you haven't stringified the result, meaning that the [
command is being given more than three arguments.
If it contains the string job completed
, you will end up with:
if [ job completed != "job completed" ] ...
I suggest you try:
if [ "$result" != "job completed" ] ...
Upvotes: 5