demo code
#!/usr/bin/env ksh
function test
{
sleep 10 &
pid=$!
typeset -i i=1
while true
do
{
ps -ef | grep -v grep | grep -q $pid
if [ $? -eq 0 ]
then
{
echo "child still running.. wait $i"
sleep 1
}
else
{
break
}
fi
((i+=1))
}
done
echo "jobs done."
}
test
exit $?