On Linux, if your log file is defined inside the script the easiest way to deal with it is to use the exec command:
SNAPLOG=$LOGDIR/snapshot.log
exec >> $SNAPLOG
exec 2>&1
# From here everything will be written in the log file without needing to use the redirection command ( > / >> )
- Log in to post comments