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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.