This recursive function causes bash to segfault: $ re() { t=$((t+1)); if [[ $t -gt 8000000 ]]; then echo foo; return; fi; re; }; re Segmentation fault (core dumped)
Ideally Bash ought to run out of memory before this fails. But an acceptable solution could also be to say 'stack overflow'. $ bash --version GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. /Ole