Question: I am trying to run a script with the output to be emailed and watched (monitored), I try using this code:

```
    this are the output: >emailmessage
    echo "output here" >>emailmessage
    /bin/mail -s "$SUBJECT" "$EMAIL" < $emailmessage

```

and an email will be sent with the results but won't be displayed on my terminal, for now I use `echo "email sent!"` so I can be notified that the script was done running. How can I send it out and display it as well?

Answer: 
Assuming your script is running with a controlling terminal (so that the output has somewhere to go to be seen) you just need to add one line:

```
/bin/mail -s "$SUBJECT" "$EMAIL" < $emailmessage
cat $emailmessage

```
```
echo "To: $EMAIL"
echo "Subject: $SUBJECT"
echo ""
echo "$emailmessage" | tee >(/bin/mail -s "$SUBJECT" "$EMAIL")
echo "sent!"

```

This uses process substitution, so I've assumed you're using bash or ksh (or similar, check your shell's man page)