process - How to write bash script to test if program crashes? -


i have program x crashes on input files.

how write bash script returns following?

  • 0 if program x terminates fine or runs longer 1/20th of second
  • 1 if program x segfaults

note program segfault or run forever, need stop somehow script. can show me please

thank ideas

most of programs when not terminate correctly return 0. information can gleaned bash variable $?. so, after run program, check if $? 0. if is, program ran successfully. otherwise, there problem.

this is, of course, assuming program following proper conventions.


Comments