INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

ksh Inter-process comm's

Simple example of TWO-WAY pipe by mi294r3
Posted: 18 Dec 02

    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 $$
    
        starts the child process with a two-way pipe |&

    displays the process ID of the child $!

    reads from the two-way pipe read -p
    and asigns what it read to CHILD_MSG

------------------------    

    child process just echo's its own process ID $$
    for the child process stdin and stdout a forced to the pipe.

------------------------

    parent process displays value of CHILD_MSG which was read from pipe

------------------------
parent script
------------------------
#!/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}"

------------------------
child script
------------------------
#!/bin/ksh
  echo $$  


          JRjr

Back to UNIX Scripting FAQ Index
Back to UNIX Scripting Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close