Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

In a c shell, how does one redirect stdout to both a log file and also screen?

Posted on 2007-04-04
2
Medium Priority
?
424 Views
Last Modified: 2013-12-26
Several years ago I did several UNIX script with Korn shell; however the c shell bit is different.

How does one capture information in both a file "and" to the screen in the same c shell script?
For example i can do the following:

echo " operation x y z was successful"  >>! test.log


echo " operation x y z was successful " > /dev/tty

Now how does capture in the log and display on the screen? I know you may write double statments for redirecting to log and screen. Is there a clean way to do this in a c shell?

Thanks in Advance

Rick
0
Comment
Question by:WmRichard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 18852690
echo " operation x y z was successful" | tee -a  test.log
0
 

Author Comment

by:WmRichard
ID: 18853068
Outstanding!

Thank you!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question