Exporting variables from subshell to parent shell

Hi,
I was trying to do something where I would be able to export one local variable in a telnet subshell to its parent shell.

I found something like this over here, but couldnt exactly understand it :(.
I am referring to this part actually:

#! /usr/bin/ksh
exec 4>&1
tail -5 >&4 |&
exec >&p
cat /etc/passwd
exitcode=$?
exec >&- >&4
wait
echo exitcode = $exitcode
exit 0

Can someone pls provide me with some explanation of the above or provide me with some link where things like exec 4>&1 and all are explained in proper detail?
Thanks.

Hi.

To export the variable value to its parent shell you can use:

#!/bin/ksh

.  subshell

and subshell:

#!/bin/ksh

export variable="value"

A useful link:

I/O Redirection

Regards

page 102, bash beginner's guide, tldp.org

Those page are about bash and so ksh's interactive coprocess and the two-way pipe are not explained there. This book explains this well: Learning the Korn Shell, Second Edition, otherwise man ksh.