I would like to defer a function execution. My current approach is something like this:
do_afterwards () {
sleep 2
echo "do something later"
}
do_afterwards &
start_my_webserver & start_monitoring_webserver
start_my_webserver & start_monitoring_webserver will run in the foreground of my terminal and "block it". I want to run do_afterwards after my Webservers started. Currently I am doing that simply with a dummy wait. How can I do this smarter?