Solved

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

Posted on 2007-04-04
2
388 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
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run same command on multiple files in Linux 3 57
Samba Question 11 75
IP 10.0.1.2 / 255.0.0.0 61 56
Apache module 5 46
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

856 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