Processes and Jobs
command & runs in the background, jobs lists them, wait waits, kill sends a signal, $! is the last background pid and ps lists processes.
Example
sleep 0.2 & pid=$!
echo "started"
kill -0 $pid && echo "running"
wait $pid
echo "finished"
( sleep 0.1; echo bg done ) &
waitResult
started running finished bg done
Exercise
Run in the background.
sleep 5 Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.