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
Post a Comment