Hi below is a script I made. I need to send an email automatically from within this script.
Now at the moment when it is run, mail asks for a subject then Ctrl to send, is there a way this can be done within the script.
if [ $# -ne 1 ]
echo "You Must Use The Correct Syntax"
echo "Syntax: test.sh username"
if who | grep "$name"
then mail -s "$name has logged on" email@example.com
echo "email sent"
echo "$name is not logged on"