LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-01-2005, 03:00 AM   #1
ericcarlson
Member
 
Registered: Jan 2002
Posts: 161

Rep: Reputation: 30
I'd like my cake & eat it too please! Log to both console and file


I have a bash job I run from a terminal which I just monitor from the screen. Now I have a need to do that and also log to file. If I use sh mybatch.sh > file.log I lose the console output. How can I do both please? Thanks
 
Old 03-01-2005, 03:07 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Hi,

Take a look at the tee command.

command | tee outfile

hope this helps.
 
  


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
Log all of a shell script's I/O to the console and a file trevelluk Programming 8 04-18-2005 01:40 PM
How to control log file size in /var/log? yan Linux - General 2 10-13-2003 05:00 PM
Complete with a cake even... MasterC General 2 08-14-2003 08:23 AM
IPTables logging going to console not the log file arobinson74 Linux - Networking 2 04-01-2003 01:20 AM
iptables, changing log file from /var/log/messages acid2000 Linux - Networking 3 03-11-2003 08:38 PM


All times are GMT -5. The time now is 08:22 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration