Results 1 to 4 of 4

Thread: redirecting input/output of program

  1. #1
    Join Date
    May 2010
    Beans
    36

    redirecting input/output of program

    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.

    Thanks

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    6,990
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: redirecting input/output of program

    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:
    Code:
    sensors-detect | tee abc.txt
    Hope that helps, and tell us how it goes.
    Regards.

  3. #3
    Join Date
    Dec 2007
    Location
    Bombay
    Beans
    6,514
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: redirecting input/output of program

    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.

  4. #4
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: redirecting input/output of program

    Use script

    Code:
    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.
    「明後日の夕方には帰ってるからね。」


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •