Re: ** UNIX : set echo on in shell
Date: Wed, 4 Mar 2009 14:06:33 +0000
Message-ID: <53258cd50903040606q902c69cyc740b3ac4e70778_at_mail.gmail.com>
A simple way of achieving what you want is to use round brackets to group together all the commands you need to log:
set -x
(
... some commands .. some more commands .. including sqlplus etc
) | tee mylogfile 2>&1
all the commands between the round brackets will have their stddout and stderr redirected to your log file. Note that (...) round brackets start a new shell; you could use {...} curly brackets in which case the commands are executed in the current hell
This way you can do everything you need within a single shell script (rather than having an outer script - or your own tired fingers - having to arrange the redirection for an inner script).
NB you can type multiple commands as
( command1; command2; )
all on one line - but I prefer to have
(
command1
command2
)
especially when the commands have lengthy options / argument lists / hereis
input
HTH Regards Nigel
2009/2/28 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-lReceived on Wed Mar 04 2009 - 08:06:33 CST