The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 06-22-2004
jyotipg jyotipg is offline
Registered User
 

Join Date: Oct 2001
Location: Bangalore
Posts: 93
Printing output to the monitor

Hi!,

In my shell scripts, I always create a logfile by adding the following line in the beginning:

exec >file.log 2>&1

This in turn directs all the output to this logfile till the script executes.

But now, I have to write some output to the monitor for the users.

So, i am doing it by the following method:
========================
CUR_DEVICE=`tty`
echo "Whatever to be outputed" >$CUR_DEVICE
========================

This works for me.. But is there any better way than this??
Reply With Quote
Forum Sponsor