repo.or.cz
/
bush.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
improve of cmpl.
[bush.git]
/
tests
/
misc
/
wait-bg.tests
blob
5035b8a1389d4541f659e4d78188168011b7413d
1
#! /bin/bush
2
3
i=0
4
while [ $i -lt $1 ]
5
do
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))
12
done
13
14
15
16
i=0
17
while [ $i -lt $1 ]
18
do
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))
25
done