I’m using elasticmq docker image to setup a local testing queue.
I setup the queue fine using
aws --region=us-west-2 --endpoint=http://localhost:9324 sqs create-queue --queue-name=jobs
But when I try to send a message I get just get an error
aws --region=us-west-2 --endpoint=http://localhost:9324 sqs send-message --queue-url http://localhost:9324/000000000000/jobs --message-body {"FileHashes": ["79054025255fb1a26e4bc422aef54eb4"] }
error is zsh: parse error near '}'
2
Answers
I was escaping incorrectly,
Using
"{"FileHashes":["79054025255fb1a26e4bc422aef54eb4"]}"
works.Braces are used in zsh to express a compound statement:
prints
Another use of braces is in the context of brace expansion:
prints
In brace expansion, there must be no wordsplitting between the braces. Hence,
would both be wrong.
A special case is a single word delimited by braces, which does not have a comma in it:
prints
In your case, you have a lone
}
, which looks to zsh as the end of a compound, but the corresponding{
is missing.Since you want neither a compound block, nor brace expansion, the simplest way would be to just not use braces as a special character, but to quote the whole stuff: