source: vendor/bash/3.1-p17/tests/misc/wait-bg.tests

Last change on this file was 3228, checked in by bird, 18 years ago

bash 3.1

File size: 360 bytes
Line 
1#! /bin/bash
2
3i=0
4while [ $i -lt $1 ]
5do
6 /bin/sh -c "sleep 4; exit 0" &
7 rv=$?
8 pid=$!
9 eval bg_pid_$i=$pid
10 echo $$: Job $i: pid is $pid rv=$rv
11 i=$((i + 1))
12done
13
14
15
16i=0
17while [ $i -lt $1 ]
18do
19 eval wpid=\$bg_pid_$i
20 echo Waiting for job $i '('pid $wpid')'
21 wait $wpid
22 rv=$?
23 echo Return value is $rv
24 i=$((i + 1))
25done
Note: See TracBrowser for help on using the repository browser.