I've read how to log certain scripts or commands individually, but nothing on how to log all commands from within a BASH shell. What I want to do is:
- User runs script. (script logs stdout/stderr from now on to a logfile)
- User does other stuff/runs other commands/echoes/etc and all of these are logged in logfile.
A less wordy / more codey example:
exec > >(tee logfile.log) when typed in by the user does exactly what I want to do. It logs stdout to logfile.log and will continue to do so until the bash shell is closed. However, running this very command as a script does not do this. I want it to.