I have this:
#!/bin/bash
trap 'echo $? $?' SIGINT
for i in `seq 10`; do
echo hello from for
sleep 10
done &
bgproc=$!
echo bgproc is $bgproc
ps -o pid,ppid,cmd
echo "waiting now"
wait $bgproc
I do
kill -2 <pid>
and get
0 0
as o/p
Question:
When I send SIGINT to this script.
Why does it terminate ? I know its because of the wait statement at the end. But whats happening there ?