LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-28-2006, 08:12 AM   #1
vineeth789
LQ Newbie
 
Registered: Jan 2006
Posts: 10

Rep: Reputation: 0
multiple redirect


hi all
i want to redirect output of stdout to a file and to screen itself
that is
bash 1>file.out
will redirect complete output to file.out
but i want that to appear in the screen and also the file

well first try

bash 1>file.out>/dev/tty1
(failed output only goin to /dev/tty1)

second try

bash 1 | tee file

(failed bash 1 is not recognized by tee)

3rd try

bash | tee file

(partial success but only stdout is redirected stderr still reamins)

an modification
2>1;
bash | tee file

supposed to work
but not workin
 
Old 01-28-2006, 10:00 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You were almost there.

tee only does stdout so as you expected you have to redirect stderr to stdout:

bash 2>&1 |tee file

You have to do the redirect for the command itself it can't be set as a global before the command as you tried. Also you have to say &1 rather than just 1.

2 = stderr
1 (&1) = stdout
 
  


Reply



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
Red Hat 7.3 and multiple gateways on multiple interfaces bluefmc Linux - Networking 2 11-19-2004 05:01 PM
how to redirect stdout [binary stream] to multiple processes vtaminh Linux - General 2 08-19-2004 01:05 PM
Redirect output to multiple places granny Linux - Newbie 1 02-12-2004 12:31 PM
Multiple Apache Sites, on Multiple IP's, on Same Box?? RickyJ Linux - General 1 06-19-2003 10:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:42 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
Open Source Consulting | Domain Registration