Capturing all input and output from a bash script

I am trying to capture all the input and output from a bash script that I created to install nagios. I have a log file created using tee right now, but it only appears when there is an echo command or some kind of output from "service httpd restart". I basically want to capture the input that the user enters into the log file for future reference.

+3
source share
1 answer

The command scriptlaunched before your program will write all the input and output data to the file you specified. It ends with ctrl-D.

script -c yourprogram filename

can do what you are looking for. See the man page for the script.

+6
source

All Articles