shell script: run a block of code in the background without defining a new function?
#!/bin/sh
{
echo "sleeping for 5 seconds"
sleep 5
echo "woke up"
} &
echo "waiting"
wait
echo "proceed"
Output
$ ./bgblock
waiting
sleeping for 5 seconds
woke up
proceed