LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-11-2006, 11:43 AM   #1
jimwelc
Member
 
Registered: Nov 2004
Location: Boston
Posts: 30

Rep: Reputation: 15
Redirect output


Hello All,

I'm very new to Linux /bash programming and I'm trying to redirect all console/session standard output to a file and then toggle it back. I can't seem to find any information on how this is done. All I can find is how to redirect output from commands. ie ls > file.txt which will not work for me. Any information or pointers will be greatly appreciated.


Best Regards,

-Jim
 
Old 05-11-2006, 11:47 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
You'll have to be more clear in your description. What does "toggle it back" mean? Why will "ls > file.txt" not work for you? What are you trying to accomplish?
 
Old 05-11-2006, 11:55 AM   #3
jimwelc
Member
 
Registered: Nov 2004
Location: Boston
Posts: 30

Original Poster
Rep: Reputation: 15
Hello macemoneta,

Basically I am trying to redirect all standard input/output/error from the terminal into a file? When I say toggle I would like to have a way of then putting this hijacking of the standard input/output/error back to its previous state. The reason why "ls > file.txt" will not work is because, and this is where its gets complicated, I am not running a command from the terminal but rather I am trying to perform this action from within a %trigger script inside and RPM. I left that out because it just confuses the matter.

Best Regards,
-Jim
 
Old 05-11-2006, 12:10 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Well, you can capture all standard output and error output with:

command &> file.txt

You can capture input with something like:

read test && echo "$test" >> file.txt

If that's not what you're trying to accomplish, then you need to provide some examples of the processing you'd like to perform.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to redirect output to a file? mus1402 Linux - Newbie 2 02-05-2006 10:42 AM
Redirect sound output to modem omega71122 Linux - Software 3 06-24-2005 04:45 PM
how to redirect the output of a terminal? cpukiller Linux - Networking 5 11-10-2004 08:07 AM
redirect untar output mnauta Linux - General 3 05-01-2004 08:21 PM
Ambiguous output redirect XFox Linux - Newbie 5 10-17-2003 08:29 PM


All times are GMT -5. The time now is 06:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration