Running this script:
#!/bin/sh
function echo {
/bin/echo `date` $*
}
function foo {
echo START foo
sleep 5
echo END foo
}
echo "start script"
foo &
echo "called foo"
sleep 10
echo "ended script"
gave this output:
Wed Apr 29 13:31:30 EDT 2009 start script Wed Apr 29 13:31:30 EDT 2009 START foo Wed Apr 29 13:31:30 EDT 2009 called foo Wed Apr 29 13:31:35 EDT 2009 END foo Wed Apr 29 13:31:40 EDT 2009 ended script
which is exactly what I would have expected. Delays in the right place and so on.
So, this means that you can do multithreaded programming in bash!
The only caveat I see so far is that the script ends when the main theread ends. Thus, the sleep 10 was needed to allow the 'child thread' enough time to run.