tech-userlevel archive

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

ash backgrounding bug?



If I do

#!/bin/sh

daemon() {
        sleep 5
}

fork_daemon() {
        ( cd /; $1 <&- >&- 2>&- & echo $! ) &
}

daemon_pid=$(fork_daemon daemon)
echo "daemon pid=$daemon_pid"

with any non-ash POSIX shell I can find, it works as I expect.
When using ash (or dash), the $() evaluation waits for daemon() to return.
Is that a bug in ash or does POSIX allow such behaviour?


Home | Main Index | Thread Index | Old Index