I learned from https://unix.stackexchange.com/a/230568/674 that
ping will exit with 0 after receiving SIGINT, which allows a bash script containing a
ping command to continue running instead of exiting.
I have a script with similar behavior:
#!/bin/bash while true; do sudo -S sleep 4; echo $? sudo -k; done
When I run it, I type Ctrl-C when it asks me for password, and the script doesn't exit, but continue running. The only difference is that
sudo upon receiving SIGINT exits with 1 not 0. So I wonder why the bash script doesn't exit but continue running? Thanks.
$ ./test.sh [sudo] password for t: 1 [sudo] password for t: 1 [sudo] password for t: 1 ...