test

  1. #!/bin/bash
  2. # bash trap command
  3. trap bashtrap INT
  4. # bash clear screen command
  5. clear;
  6. # bash trap function is executed when CTRL-C is pressed:
  7. # bash prints message => Executing bash trap subrutine !
  8. bashtrap()
  9. {
  10. echo "CTRL+C Detected !...executing bash trap !"
  11. }
  12. # for loop from 1/10 to 10/10
  13. for a in `seq 1 10`; do
  14. echo "$a/10 to Exit."
  15. sleep 1;
  16. done
  17. echo "Exit Bash Trap Example!!!"