Experimente esta versão:
#!/bin/bash
hostname='cat /etc/hostname'
current_mailq="'postqueue -p | tail -n 1 | cut -d' ' -f5'"
yourEmail="[email protected]"
echo "$current_mailq"
if (( "$current_mailq" >= "100" )) ; then
echo "Mail queue problem - there is currently $current_mailq mails in queue. Please check it out." > check_email_queue_outgoing.txt
mail -s "$hostname - mail queue alert - there are $current_mailq emails in queue" "$yourEmail" < check_email_queue_outgoing.txt
else
echo "Mail queue is fine - there is currently $current_mailq mails in queue. Please check it out."
echo "Do nothing, situation is fine."
fi
Preste atenção, é muito difícil fazer um bom código bash / sh / cmd portátil. IMO, é melhor usar o Idioma do Google e criar programas portáteis claros para qualquer sistema operacional.