Hi All,
I have a peculiar problem. I will call a script from another script.
Script abc.ksh is called by ABC.ksh as
ABC.ksh abc.ksh
in abc.ksh I will create and redirect all the statements to log file.
ABC.ksh will also has a log file. I want all the logs generated in file abc in ABC too.
The log file generated in abc.ksh does not have particular name format to redirect me to ABC.ksh file.
Any help is appriciated.
Thanks
If anyone didn't understand anything, please let me know.
Thanks
First redirect STDOUT/STDERR in the ABC.ksh script:
exec > ABC.log 2>&1
Then inside the ABC.ksh script invoke the abc.ksh script like this:
abc.ksh 2>&1 | tee -a ABC.log abc.log
You'll end up with something like this:
ABC.ksh
exec > ABC.log 2>&1
abc.ksh 2>&1 | tee -a ABC.log abc.log
javeed7:
Hi All,
I have a peculiar problem. I will call a script from another script.
Script abc.ksh is called by ABC.ksh as
ABC.ksh abc.ksh
in abc.ksh I will create and redirect all the statements to log file.
ABC.ksh will also has a log file. I want all the logs generated in file abc in ABC too.
The log file generated in abc.ksh does not have particular name format to redirect me to ABC.ksh file.
Any help is appriciated.
Thanks
i am bit confused!!!
you want to redirect all the statements of abc.ksh and ABC.ksh to a single log file???
let me explain my problem with example
abc.ksh
echo 'Hi' > ab_log.log
echo 'i will run some commands' >>ab_log.log
echo 'Will do some manipuations >> ab_log.log
echo 'end' >>ab_log.log
ABC.ksh (abc is passed as parameter)
echo "Running the script $1" >ABC_log.log
. $1.ksh >> ABC_log.log
echo 'End ' >> ABC_log.log
Now the log generated by abc.ksh, i want the log in ABC_log.log
Here I have hard coded the file names, if they r generic then ?
Could anyone suggest a good logic.
Thanks in advance.