Bug 15631

Summary: sleep command after '&' in a shell script has no effect
Product: Busybox Reporter: Manhong <manhongdai>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED DUPLICATE    
Severity: blocker CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

Description Manhong 2023-06-17 21:04:58 UTC
In BusyBox v1.36.1 coming with Alpine Linux 3.18.2 for Raspberry Pi, the script below will return immediately. However, on all old versions of BusyBox, such as v1.35.0 on Alpine Linux 3.17.3 on Raspberry Pi, it will return after 60 seconds.

#!/bin/sh
for i in 0 1 2 3 4 5
do
	echo "Loop: $i" &
	sleep 10
done
Comment 1 Manhong 2023-06-17 23:48:27 UTC
A workaround is to add a pair of parenthesis to the command that need to be in the background. 


#!/bin/sh
for i in 0 1 2 3 4 5
do
	( echo "Loop: $i" & )
	sleep 10
done
Comment 2 Tero Saarni 2023-07-09 07:32:12 UTC
This is the same bug as reported in https://bugs.busybox.net/show_bug.cgi?id=15619
Comment 3 Manhong 2023-07-09 11:59:09 UTC

*** This bug has been marked as a duplicate of bug 15619 ***