Help in korn shell scripting...
Moderators: chulett, rschirm, roy
Help in korn shell scripting...
Hi,
How to achieve this? Let us assume the following:
There are 2 scripts a.ksh and b.ksh
$ cat a.ksh
sh b.sh 2>&1 >> /work/log/a_log.txt
$ cat b.sh
echo "abcd"
My requirement is, is there a way to display this abcd in standard output also alongside of writing into a_log.txt?
The catch here is I cannot modify the script a.ksh as there are innumerous shell scripts like a.ksh that call b.ksh. So here I can modify b.ksh alone to achieve the result.
Please suggest if there is anyway to modify b.ksh to output the result to standard output as well.
Please help me out in this. Appreciate your help.
How to achieve this? Let us assume the following:
There are 2 scripts a.ksh and b.ksh
$ cat a.ksh
sh b.sh 2>&1 >> /work/log/a_log.txt
$ cat b.sh
echo "abcd"
My requirement is, is there a way to display this abcd in standard output also alongside of writing into a_log.txt?
The catch here is I cannot modify the script a.ksh as there are innumerous shell scripts like a.ksh that call b.ksh. So here I can modify b.ksh alone to achieve the result.
Please suggest if there is anyway to modify b.ksh to output the result to standard output as well.
Please help me out in this. Appreciate your help.
Vignesh.
"A conclusion is simply the place where you got tired of thinking."
"A conclusion is simply the place where you got tired of thinking."
Not really, since a.ksh completely controls the stderr and stdout of b.sh. The only suggestion I have is to rename b.sh to c.sh. Then, write a new b.sh that does whatever you desire with the stdout of c.sh as well as send it to stdout for a.ksh to handle. Consider looking at the "tee" command.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi
Thanks for all your inputs. I want the output to be displayed to stdout as it should be displayed in the system output log of the scheduler. But per Bland, it looks like we cannot do it straight forward as both stdout and stderr are controlled in a.ksh. I think we have to bypass using a 3rd script as per Bland's idea. Please let me know, if there is any other suggestion. Thank you very much again!
Thanks for all your inputs. I want the output to be displayed to stdout as it should be displayed in the system output log of the scheduler. But per Bland, it looks like we cannot do it straight forward as both stdout and stderr are controlled in a.ksh. I think we have to bypass using a 3rd script as per Bland's idea. Please let me know, if there is any other suggestion. Thank you very much again!
Vignesh.
"A conclusion is simply the place where you got tired of thinking."
"A conclusion is simply the place where you got tired of thinking."
I'm right because you stated you can't modify a.ksh, and that's where you'd have to insert the "tee" without using my suggestion.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Re : Help in korn shell scripting...
Basically you issue two commands in a.sh
sh b.sh 2>&1 >> /work/log/a_log.txt
sh b.sh 2
That should do it.
Forboy
sh b.sh 2>&1 >> /work/log/a_log.txt
sh b.sh 2
That should do it.
Forboy
Re : Help in korn shell scripting...
oops sorry its
sh b.sh 2>&1 >> /work/log/a_log.txt
sh b.sh
That should do it.
Forboy
sh b.sh 2>&1 >> /work/log/a_log.txt
sh b.sh
That should do it.
Forboy