The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Dynamically redirect output to duplicate files ??? nsinha Shell Programming and Scripting 3 10-09-2007 07:04 AM
How redirect output(error and normal) to 2 different files balareddy Shell Programming and Scripting 2 09-12-2007 01:05 PM
redirect output of FTP kcaluwae Shell Programming and Scripting 4 06-23-2005 08:45 AM
can you redirect multiple files for input? Matrix_Prime UNIX for Dummies Questions & Answers 4 02-27-2005 07:07 PM
Redirecting output to multiple log files? darthur UNIX for Dummies Questions & Answers 3 01-15-2002 12:54 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-20-2003
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
Redirect output to multiple files.

Hi,

I am new to shell scripting and have a question. I would like to redirect the output of a command to multiple files, each file holding the exact same copy. From what I read from the bash manpage and from some searching it seems it cannot be done within the shell except setting up a loop. Is it?
  #2 (permalink)  
Old 08-20-2003
davidg's Avatar
davidg davidg is offline
Registered User
  
 

Join Date: Jul 2003
Location: Holland
Posts: 207
Hi,

Unix has a beatifull command for that : "tee"

perform a :

who | tee -a file1 file2 file3 file4

this will write the output of who to your screen, file1,file2,file3 and file4.

Please look at "man tee" for all the details.

Regs David
  #3 (permalink)  
Old 08-20-2003
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
Thanks very much for your reply.

From my search I have found `tee' can do it. However, actually I would like to ask if it can be done directly on the shell without using external programs, on the bash shell for example.
  #4 (permalink)  
Old 08-20-2003
davidg's Avatar
davidg davidg is offline
Registered User
  
 

Join Date: Jul 2003
Location: Holland
Posts: 207
Nope, you have one STDIN, STDOUT, STDERR device redirected to your TTY, you can choose to redirect it to a file, but not both without using tee.

If you are searching for this in cause of user auditing, there are multiple methods for it. Please us know if this is the case.

Regs David
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0