#!/bin/bash
filename='delete'
while read p; do
jq 'if .tweet | test('\"$p\"'; "i") then . |= . + {vendor: '\"$p\"'} else empty end' sfilter.json
done < $filename
I keep getting this error, when I use variable = "hello world" but not "hello" Inshort whenever there is a space in letter it causes this error.
But while executing directly on shell there seems to be no error.
jq: error: syntax error, unexpected $end, expecting QQSTRING_TEXT or QQSTRING_INTERP_START or QQSTRING_END (Unix shell quoting issues?) at <top-level>, line 1:
if .tweet | test("sdas
jq: 1 compile error
But when I run the command on shell it works perfectly. Any ideas?
Edit: Input delete file
sdas adssad