I need to check if my program's output is being redirected; if yes I need to keep and send its by mail.
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." [email protected]
fi
myprogram > something, you want to mail the content ofsomething?