unix - Curl Inside While loop results in fails due to syntax error -


i trying call variable inside while loop curl. if pass value directly works fine if pass variable keeps failing.

#!/bin/bash while ifs= read -r line || [[ -n "$line" ]];    curl -xpost 'http://localhost:8080/_count?pretty' -d '    {       "query": {       "bool": {       "must": [ {              "term": {                       "m": "image"                      }                 }, {              "term": {              "c": "$line"            }}]}}}'   done < "$1"  

say sample file having data :--

 abc:124:456  abc:345:786 

i not sure why running syntax error . anywhere missing anything?

regards

@john gordon .. thank . able fix inputs.

"shell variables aren't expanded inside single quotes"


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -