I need to run a curl command from a shell script that reads a file of host names. Here is the script that does not work:
#!/bin/sh
HOST="HOSTNAME"
curl https://SOME_URL -H 'Content-Type: application/json' -H 'API-Key: SOME_KEY' --data-binary '{"query":"{\n actor {\n entitySearch(query: \"name LIKE \u0027$HOST\u0027\") {\n results {\n entities {\n guid\n }\n }\n }\n }\n}\n", "variables":""}'
The problem is name LIKE \u0027$HOST\u0027
I need the \u0027
for the single quote character.
If I use an actual host name instead of the variable it works fine.
I tried curly braces around the variable and that doesn't work.