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.
Jeremy.
#!/bin/sh
if [ $# -ne 1 ]
then
echo "You Must Use The Correct Syntax"
echo "Syntax: test.sh username"
else
name=$1
if who | grep "$name"
then mail -s "$name has logged on"
simmondj@basil.it.net
echo "email sent"
else
echo "$name is not logged on"
fi
fi