In Bash you can redirect all future stdout output of the currently running script. For example with this script,
exec > >(logger -t my-awesome-script)
echo 1
echo 2
echo 3
This will end up in syslog:
Oct 26 01:03:16 mybox my-awesome-script[72754]: 1
Oct 26 01:03:16 mybox my-awesome-script[72754]: 2
Oct 26 01:03:16 mybox my-awesome-script[72754]: 3
But this is Bash-specific and the naked exec with redirection doesn't seem to work in Dash.
Syntax error: redirection unexpected
How can I make it work in Dash, or possibly in both shells?
>
in dash. I realize you seem to be asking for something else but I can't quite tell what it is.