LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Capture all stdin of shell to a file. (https://www.linuxquestions.org/questions/linux-newbie-8/capture-all-stdin-of-shell-to-a-file-476866/)

jimmax777 08-24-2006 03:00 AM

Capture all stdin of shell to a file.
 
Hi Linuxers

I am trying to make a script which will enable me to capture all the commands I type on my prompt to be saved into a file. I know it is possible just that I cannot find link to it on the net and I dont know how to do it. Any help will be really appreciated.

Thanks

timmeke 08-24-2006 03:24 AM

Why do you need that?
See the man pages of your shell, especially the 'history' command.

jimmax777 08-24-2006 03:28 AM

I need to save all the day's work and see whats happenning
 
I am working on a new product and I shall be running a lot of commands. So I just want to save it to a particular file. Thats it. I know it can happen. Its not about shell pages. Its just a small script.

Anyways thanks for the concern.

timmeke 08-24-2006 05:22 AM

You could use the "script" command for creating a typescript of your terminal session, but it probably also saves the output of your commands. So, you may want to add output redirection to your commands if you don't want to get your output in the typescript file.

jimmax777 08-24-2006 05:25 AM

Yes I know about the script command but I dont want the output also to be re-directed. I just want that whatever goes to stdin should be copied to the file.

Anyways thanks.

spirit receiver 08-24-2006 06:22 AM

The following works with Bash (to some extent at least):
Code:

exec 0< <( tee -a logfile )


All times are GMT -5. The time now is 05:36 PM.