I am trying to capture all the input and output from a bash script that i created for installing nagios. I have it creating the log file using tee right now but it only shows when there is an echo command or some output from like "service httpd restart". I mainly want to capture the input the user is entering in the log file for future reference.
The script command, run prior to your program, will capture all input and output to a file you specify. It terminates with a ctrl-D.
script -c yourprogram filename
may do what you're looking for. See the man page for script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With