summaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-signals/signal1.tests
blob: 49a395bad8f4f89ef10f0739ee6903186049eb83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
sleeping=true

trap "echo got signal" USR1

for try in 1 2 3 4 5; do
    kill -USR1 $$
    sleep 1
    echo sent $try signal
done &

sleep 10 &

while $sleeping; do
    trap
    if wait %%; then
        echo sleep completed
        sleeping=false
    elif [ $? == 127 ]; then
        echo no sleep tonite
        sleeping=false
    else
        echo sleep interrupted;
    fi
done