Operating System - HP-UX
1825720 Members
2932 Online
109686 Solutions
New Discussion

Re: redirect and display at the same time

 
Vijaya Kumar_3
Respected Contributor

redirect and display at the same time

Hi all,

I am running a shell script... say test.ksh.

When I start the script, I need to log redirect the output to a log file and at the same time, I need to key in inputs as well... how can i do that?

Thanks in advance
Vijay

Known is a drop, unknown is ocean - visit me at http://vijay.theunixplace.com
4 REPLIES 4
Vijaya Kumar_3
Respected Contributor

Re: redirect and display at the same time

tee command will do?
Known is a drop, unknown is ocean - visit me at http://vijay.theunixplace.com
Muthukumar_5
Honored Contributor

Re: redirect and display at the same time

You can do this as,

1.# script logfile.log
# ./script.sh
# exit

2. Using tee as,

# ./script.sh | tee logfile

hth.
Easy to suggest when don't know about the problem!
Eknath
Trusted Contributor

Re: redirect and display at the same time

Senthil Kumar .A_1
Honored Contributor

Re: redirect and display at the same time

Hi Vijay,

As others have suggested ,,you can use "tee" for the purpuse of redirecting the O/P to a file as well as displaying the output on terminal..BUT,

your requirement seems to be different.. you have asked directing you aoutput to a file and able to input from terminal..

In this case, you don't require "tee"...

because...

If your script test.ksh is expecting a input...

simply

./test.ksh >> /tmp/output file
would suffice..because..you are rediecting the STD OUT not STD IN.. hence, irrespective of whether you have redirected your output or not..still the script will expect a STD IN ..if your script is written to expect one..

Regards.
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)