I can easily redirect both standard and error output of a bash script to the file, while discarding an output to console with simple exec
statement:
exec &>>/var/log/backup.log
But how do I use exec
to write to two files, appending to first and rewriting the second? Probably some tee
magic should be used. And also some way to mute the console should be found.
The reason for this is a backup script of mine. I want to append to the main log the events of latest backup and just write only these events to the current backup log (clearing its previous content), which should be rewritten each backup session.