View Full Version : redirecting input/output of program

May 19th, 2012, 04:54 AM
Hi all,
Beginner here. I need to output the results of the command "sensors-detect" to a text file but I'm have trouble figuring out how to do it. Because I need to input "yes or no", the "sensors-detect > abc.txt" command doesn't seem to work.

No help from google since I have no clue what to search for. Some help is greatly appreciated.


May 19th, 2012, 05:38 AM
Hi phillyj.

I'm not familiar with sensors-detect, but you may try to double the output both to a file and the screen using the command 'tee'.

Try this:

sensors-detect | tee abc.txt
Hope that helps, and tell us how it goes.

May 19th, 2012, 07:39 AM
I think his difficulty is that after typing the command, at some point he has to type "yes" or "no". In other words, input is required.

May 20th, 2012, 04:36 AM
Use script

script log.txt

will start a new shell and everything will be printed to log.txt. Run your command and type exit when you are done.