Advertisement
Guest User

using trap to catch segfault

a guest
Oct 30th, 2012
1,823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.24 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement