Script in Solaris when usage in all filesystem >90% & send a mail i don't know how to send mail from script
#!/bin/bash
# Outputs alert if filesystem is above 90%
{
for fs in $(df -hk | awk '{print $6}' | sed '1 d'); do
chk=$(df -hk ${fs} | sed '1 d' | awk '{print $5}' | awk -F\% '{print $1}')
if [ ${chk} -gt ${threshold} ]; then
echo "$(hostname): Alert Fileystem ${fs} is above ${threshold}%."
fi
done
It's getting "unary operator expected".