This is an very simple example of a ksh script that starts
a child process with a two way pipe.
The Parent process displays its process ID [color green]$$[/color]
starts the child process with a two-way pipe [color green]|&[/color]
displays the process ID of the child [color green]$![/color]
reads from the two-way pipe [color green]read -p[/color]
and asigns what it read to CHILD_MSG
[color red]------------------------[/color]
child process just echo's its own process ID [color green]$$[/color]
for the child process stdin and stdout a forced to the pipe.
[color red]------------------------[/color]
parent process displays value of CHILD_MSG which was read from pipe
[color red]------------------------[/color]
parent script
[color red]------------------------[/color]
[color green]#!/bin/ksh
echo "My Process ID is $$"
child |&
echo "The childs process ID is $!"
read -p CHILD_MSG
echo "The child states his process ID is ${CHILD_MSG}"[/color]
[color red]------------------------[/color]
child script
[color red]------------------------[/color]
[color green]#!/bin/ksh
echo $$ [/color]
JRjr
![[morning] [morning] [morning]](/data/assets/smilies/morning.gif)