'wait' program does not wait

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings!

'wait' does not wait for all jobs and return a non-zero exit status.

According dash(1):

wait [job]
Wait for the specified job to complete and return the exit status
of the last process in the job. If the argument is omitted, wait
for all jobs to complete and the return an exit status of zero.

$ cat test.sh
#!/bin/dash
func() {
	sleep $1
	echo "func($1)"
}
func 1 &
func 2 &
func 3 &
wait

$ dash ./test.sh; echo "after rc=$?"
func(1)
after rc=145
func(2)
func(3)

$ bash ./test.sh; echo "after rc=$?"
func(1)
func(2)
func(3)
after rc=0

-- 
Rgrds, legion

--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux