Catching core dumps in a shell script

David Gibson david at
Mon Feb 4 13:45:54 EST 2002

On Mon, Feb 04, 2002 at 12:14:58PM +1100, Michael Still wrote:
> Hey all.
> I have some code I am playing with which should be able to parse PDF files
> in a generic manner. I have a simple shell script which runs the parser on
> a whole bunch of PDF files so see where I need to fix bugs.
> My problem is that sometimes the parser core dumps, and these files then
> don't get listed as having failed. Testing for the existance of a file
> named core in the for loop doesn't seem to work... I am not sure why.

A segfaulting program will return with non-zero status to the shell
(139 to be specific).  It will count as "false" if run in a shell "if"

David Gibson			| For every complex problem there is a
david at	| solution which is simple, neat and
				| wrong.  -- H.L. Mencken

More information about the linux mailing list