Bash if statement equal output from last command
- by mYzk
I am trying to equal something from last command with bash if statement:
#!/bin/bash
monit status
if [ "status" != "error" ]; then
echo -e "hostname\ttest\t0\t0" | /usr/sbin/send_nsca -H hostname -c /etc/send_nsca.cfg
exit 1;
fi
Even if the monit status gives out status = online with all services it runs the echo command. I can not figure out how to make the if statement match the status of monit status output.