Okie I have gone forward and done some more research on the same.
Your idea of using C shell is very true and it works. But I guess I won't be able to use the same.
As long as the signal getting passed to korn shell is concerned here is my analysis.
If i use the following script,
==================================================
#!/bin/ksh
ulimit -t 1
trap 'echo "CPU time limit exceeded"; exit 2' XCPU
num=1
while true
do
echo $num >> haha
num=`expr $num + 1`
done
Output:
asakpal[/export/home/asakpal] ksh r.sh
CPU time limit exceeded
asakpal[/export/home/asakpal] echo $?
2
asakpal[/export/home/asakpal]
==================================================
then the trap works fine and it does what it's supposed to do.
Basically this argument refutes the fact that
"But ksh does not make all signals available to the script for direct manipulation."
But on the other hand if i use this following script.
==================================================
#!/bin/ksh
ulimit -t 1
trap 'echo "CPU time limit exceeded"; exit 2' XCPU
find / -name "*haha*" 2> /dev/null
Output:
==================================================
then I get a core dumped error. But I still do not get a my echo message.
What baffles me is that for one type of execution trap works while for other it doesn't. Any more ideas