0

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?

4
  • 2
    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? Commented May 13 at 12:09
  • @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? Commented May 15 at 21:57
  • The question is tagged bash and bashrc, but now we're talking about .zshrc. Inconsistency does not help. Commented May 16 at 3:37
  • 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 )
    – jhnc
    Commented May 24 at 16:20

0

You must log in to answer this question.

Browse other questions tagged .