I would like to expend some disk space recording all input and output to my terminal sessions; /usr/bin/script
appears to be fairly good at that. I would like to make it so all new shell sessions (Currently I use/bin/bash
) could start inside a script
session that logged to a file by the name of say ~/.log/$(date --iso-8601=second).log
I've tried calling script
at the end of my .bashrc file but recall it basically crashing and making opening a new shell impossible.
Any ideas on a possible way to keep this kind of record? I already have an "Eternal bash history" but just knowing the inputs is not always enough for me.
Best Answer
I don't think putting it at the bottom of your rcfile would do much good - all of the state you declared beforehand would get wiped out when
script
loaded a new shell until it tried to load the rcfile and etc and etc forever. I just made it work on my terminal like:And so I think you'd do better to locate it at the head of your rc-file, and then
exec
a new shell to read the rest of it after the point you call the new shell.