skip to Main Content

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


  1. Chosen as BEST ANSWER

    I was escaping incorrectly,

    Using "{"FileHashes":["79054025255fb1a26e4bc422aef54eb4"]}" works.


  2. Braces are used in zsh to express a compound statement:

    { echo a; echo b }
    

    prints

    a
    b
    

    Another use of braces is in the context of brace expansion:

    echo {a,b}
    

    prints

    a b
    

    In brace expansion, there must be no wordsplitting between the braces. Hence,

    echo {a, b}
    echo {a,b }
    

    would both be wrong.

    A special case is a single word delimited by braces, which does not have a comma in it:

    echo {ab}
    

    prints

    {ab}
    

    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:

    --message-body '{"FileHashes": ["79054025255fb1a26e4bc422aef54eb4"] }'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search