Let's start our activity as follows:
- Open a terminal and create the loop_and_print.sh script:
#!/bin/bash EXIT_PLEASE=0INC=0until [ ${EXIT_PLEASE} != 0 ] # EXIT_PLEASE is set to 0, until will never be satisfieddo echo "Boo $INC" > /dev/null INC=$((INC + 1)) sleep 1doneexit 0
- Open a terminal and run the following commands:
$ bash loop_and_print.sh &$ ps aux | grep loop_and_print.sh # Take note of the PID - write it down
- Next, log off, then log in and run the following command in a new terminal:
$ ps aux | grep loop_and_print.sh # Take note of the PID - write it down
- Can you find the process running? Next, run the following command:
$ bash loop_and_print.sh & # note the PID againg$ disown
- Next, log off, then log in ...