Hi Ravi,
If you start any process in ksh using |& instead of the usual &, the
korn shell will create a special two way pipeline between the two
shells. The shell you are working on presently is the parent shell and
the background shell is the child shell. The read -p in the parent
shell reads a line of the standard output of the child shell.
Similarly print -p in the parent shell prints a line on the standard
input of the child shell. In short, input to the child shell can be
given using print -p and the output of it can be read using read -p.
So it may be clear from now that the child shell can be any predefined
program with a standard input and output. Now consider the following
example, I start sqlplus using |& and communicate with it using the
parent shell.

$sqlplus -s ${USR_PWD} |&
$print -p "SELECT count(*) FROM dba_objects WHERE status != 'VALID';"
$read  -p OUT

The  result prints the number of dba objects with status as INVALID.

Similarly, this functionality can be used in several places. Hope I
have cleared your doubt.

Regards,
Harish R

On 12/22/09, Ravi Jaya <[email protected]> wrote:
> Hi,
> How to use -p option of the print command in korn shell
> *This is an extraction from man print*
> -p If you have started a co-process running with the *|&* command (see
> ``More
> about redirecting input and
> output''<http://osr507doc.sco.com/en/OSUserG/_redirect_input_and_output.html>),
> the *-p* flag makes *print* send its output to the co-process via a pipe.
> if you could give me an example for print -p, it would be much better [1].
>
> Thanks
>
> [1] I go-ogled enough before posting in the list.
> --
> Ravi Jaya
>
> Mobile: +91 97909 16181
>
> Blog:
> http://aryabhataa.blogspot.com/
> http://ravi-jaya.blogspot.com/
> _______________________________________________
> ILUGC Mailing List:
> http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
>


-- 
Harish.R.

http://openview-harish.blogspot.com

Don't design your character as a garden where everyone can walk
Design it as the sky where everyone will aspire to reach
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to