This is the last line in my .bashrc (lines breaks inserted for readability):
STARTTIME=`date +%F-%Hh-%Mm-%Ss-%N`; \
script -q -t 2> /home/USER/logs/$STARTTIME-timing.txt \
-c 'bash --rcfile /home/USER/.bashrc-cp' \
-f /home/USER/logs/$STARTTIME-log.txt; \
gzip -9 /home/USER/logs/$STARTTIME-timing.txt /home/USER/logs/$STARTTIME-log.txt; \
exit 0
There is a /home/USER/.bashrc-cp without this mentioned last line (but it's an exact copy of my .bashrc).
This terminal logging solution works great. There are only two problems:
Q1: If I exit the gnome-terminal with Alt+F4 then the logs aren't gzipped. Why? How can I gzip them in that case?
Q2: I don't want to use a .bashrc-cp file. Are there any solutions for it?