fork download
  1. #/bin/sh
  2. # Scriptname: trapping
  3. # Script to illustrate the trap command and signal
  4.  
  5. trap 'echo "CtrlC will not interupt this process
  6.  
  7. trap 'echo "CtrlD will not terminate this process
  8.  
  9. echo "Enter any string after the prompt."
  10. echo "When you are ready to exit, type \"stop\"."
  11. while true
  12. do
  13. echo n "Go ahead...> "
  14. read reply
  15. if [ "$reply" = stop ]
  16. then
  17. break
  18. if
  19. done
  20.  
Success #stdin #stdout 0.01s 2284KB
stdin
Standard input is empty
stdout
0
0
0