SHARE
TWEET

using trap to catch segfault

a guest Oct 30th, 2012 1,190 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. trap 'if [[ $? -eq 139 ]]; then echo "segfault !"; fi' CHLD
  3.  
  4. count=0
  5.  
  6. while :
  7.  do
  8.    sleep 1
  9.    count=$(expr $count + 1)
  10.    echo $count
  11.    ./code >& log
  12.    if [ "$?" -ne 139 ]
  13.         then
  14.                 exit
  15.    fi
  16.  done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top