How to debug bash scripts dumping core

Updated -

Example

In the rest of the article, the following example script will be used:

$ cat recurse.sh
#!/bin/bash

recursive2() {
    recursive1
}

recursive1() {
    recursive2
}

recursive1

Upon being called, after some time, bash will fail with Segmentation fault and dump a core, assuming ulimit -c is not tuned to 0:

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content