I am trying to run the following, as a test for something else:function echo_test {  sleep 60 & > /dev/null  returnpid=$!  echo $returnpid}pidthatwasreturned=$(echo_test)echo This was the value that was returned by the function:echo $pidthatwasreturnedThe problem is that the function doesn't exit and return until the sleep has finished, even though it has been run in the background. In the script that I am developing, the sleep command will effectively be replaced by a long running command. Is there some way in which I can rewrite this function to get it to return immediately?
echoing a value from a BASH function after a command has been run in the background
bash;shell script