Re: ** UNIX : set echo on in shell

From: Dan Norris <dannorris_at_dannorris.com>
Date: Sat, 28 Feb 2009 20:46:45 -0600
Message-ID: <49A9F715.1010405_at_dannorris.com>




  
  


Here's how I generally handle logging in most of my scripts (this is
obviously from an RMAN backup script):

##################################################
### Start log
DT=`date +%Y%m%d%H%M%S`
LOG=${LOGS_DEST}/RMAN_${ORACLE_SID}.${LOCALHOST}.INC_$2.$DT.log
rm -f $LOG

### save the file descriptors
exec 3>&1
exec 4>&2

### set up output streams
exec 1> $LOG
exec 2>> $LOG


...do all my stuff here, all output (STDOUT and STDERR is automatically sent to the $LOG because of the commands above
...when I'm done, put this stuff at the bottom:


############################################################
### Wrap up
DT=`date +%Y%m%d%H%M%S`
echo "Finished rman backup of $ORACLE_SID on $LOCALHOST (LEVEL $2) : " `date +%Y%m%d%H%M%S`

### restore the file descriptors
exec 1>&3
exec 2>&4



Mindaugas Navickas wrote:
This should work - it redirects stderr (2) to stdout (1)
set -x
sqlplus ..... > $OUTFIL 2>&1
...
set +x
Regards
Mike Navickas


From: A Joshi ajoshi977_at_yahoo.com
Hi,
   I am looking for a shell equivalent of  set echo on. set -x works and gives the output on the screen. I am looking for a way so that it also goes to the LOGIFLE. So I can get the command being executed in the log. For example  if I have  :
set -x
sqlplus ..... > $OUTFIL
...
set +x

Then I want the output to go to log file. It displays on the screen but does not go to log. From the log it is difficult to know which sqlplus had the error. I tried to put a echo before the sqlplus to know it but i have to update it each time so looking for a better way. Zoran and Frank helped out dba village and I have made progress to this point. Could not find much on net. Thanks

-- http://www.freelists.org/webpage/oracle-l Received on Sat Feb 28 2009 - 20:46:45 CST

Original text of this message