| 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Run with different shells to see if you an cancel it. |
| 4 | # |
| 5 | # Usage: |
| 6 | # $SH ./ctrl-c.sh <function name> |
| 7 | |
| 8 | # Cancel this loop |
| 9 | process-loop() { |
| 10 | while true; do |
| 11 | echo --- |
| 12 | sleep 0.01 |
| 13 | done |
| 14 | } |
| 15 | |
| 16 | tight-loop() { |
| 17 | for i in $(seq 1000000); do |
| 18 | true # builtin |
| 19 | done |
| 20 | } |
| 21 | |
| 22 | "$@" |