Bug 15631 - sleep command after '&' in a shell script has no effect
Summary: sleep command after '&' in a shell script has no effect
Status: RESOLVED DUPLICATE of bug 15619
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: Other Linux
: P5 blocker
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-17 21:04 UTC by Manhong
Modified: 2023-07-09 11:59 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***