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
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
This is the same bug as reported in https://bugs.busybox.net/show_bug.cgi?id=15619
*** This bug has been marked as a duplicate of bug 15619 ***