I need to check if the output of my program is redirected; if so, I need to save and mail it.
Example:
$ myprogram -param1 -param2 -param3 > /home/polly/log.txt
myprogram.sh :
if 'redirection is not empty'; then cat <redirection name> | mailx -s "This is a test email." polly@gmail.com fi
source share