I've tried pretty much everything I know about .sh to get this script to work and I'm now beyond clueless to why it doesn't. A .sh lint says its should work completely fine except for "{" being literal, which I'm not worried about. A cronjob runs this .sh script every 12 hours and each time I test it, all that comes up is "Command 200 not found." as if the 200 error code that i told the .sh script to look for is a command in itself. Any ideas?
#!/bin/bash
webhook_url="webhook-url"
websites_list="website.com"
for website in ${websites_list}; do
status_code=$(curl --write-out %{http_code} --silent --output /dev/null -L ${website})
if "$status_code" 200 ; then
curl -H "Content-Type: application/json" -X POST -d '{"content":"'"${website} did its usual 12 hour check. Code: ${status_code}"'"}' $webhook_url
fi
done
Pretty clueless to be honest, I'm relatively new to all of this anyway.