Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Is there some way to record not only the commands that I type in my terminal, but also their ouput? Is there maybe something that I can add to my .bashrc that could act similar to passing all commands through tee?
script. There is probably a duplicate question here somewhere, but searching is hard due to the legion of questions about shell scripts. Does this answer your question? Terminal output history?
@KamilMaciorowski Yes, the script command seems to be exactly what I am looking for. However when I add this to my .zshrc, it will start an infinite loop, because after calling script it will start a new session using the zshrc calling script again etc. Do you have any idea?
To prevent infinite regress you need to define a base case / termination condition. A simple method here would be to test for a shell variable that you export when you run script (eg. [ -n "$InScript" ] || InScript=yes script )
script
. There is probably a duplicate question here somewhere, but searching is hard due to the legion of questions about shell scripts. Does this answer your question? Terminal output history?bash
andbashrc
, but now we're talking about.zshrc
. Inconsistency does not help.eg. [ -n "$InScript" ] || InScript=yes script
)