Last active
          December 25, 2015 01:29 
        
      - 
      
- 
        Save danielribeiro/6895259 to your computer and use it in GitHub Desktop. 
    self killing shell
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| # trap "kill -- -$BASHPID" SIGINT SIGTERM EXIT | |
| trap 'exit 42' SIGINT SIGQUIT SIGTERM | |
| function sayit() { | |
| while [[ 1 ]] | |
| do echo oi | |
| sleep 1 | |
| done | |
| } | |
| sayit & | |
| echo it is running | |
| sleep 1 | |
| echo i m almost done | |
| kill 0 | |
| # kill -HUP -$$ | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment