I added the following command near the top of my shell script in order to record the script output to a file. This works with no problem when I run the script as my user, jsmith, however when the script is run as root in a crontab, I receive an error:
syntax error near unexpected token:
exec &> >(tee $LOG_PATH$TIMESTAMP.log)
I do have both $LOG_PATH and $TIMESTAMP correctly defined above the command as:
LOG_PATH="/home/jsmith/script/logs/"
TIMESTAMP="$(date -d "today" +"%Y-%m-%d-%H:%M")"
Any ideas? Thanks!