while [ 1 ]
do
sleep 1
echo hello
done
while true; do sh sleep.sh; echo 'sleep.sh has crashed, restarting'; sleep 1; done
run the invocation
ps | grep sleep.sh
, find the pid of the runningsh sleep.sh
kill 123
- observe the "monitor" announce the restart and the series of "hello" start up again