kristina kristina - 7 months ago 15
Bash Question

How can I capture all commands and output on the command line?

I want to be able to get the commands, stderr, and stdout for a sequence of commands I run, so that I could edit it and then copy-paste it to mailing lists, bugs, whatever. E.g., optimally it would pipe to a file (as I ran things):

$ mkdir temp
$ cd temp
$ touch file1 file2
$ cat > file1 <<EOF
some content
EOF
$ cat file1
some content
$ # etc.


Anyone got a handy script to do this, or is there anything built-in?

Answer

Anyone got a handy script to do this, or is there anything built-in?

Does the script(1) utility do what you want?