The docs say this: '-batch' Run in batch mode. Exit with status '0' after processing all the command files specified with '-x' (and all commands from initialization files, if not inhibited with '-n'). Exit with nonzero status if an error occurs in executing the GDB commands in the command files. Batch mode also disables pagination, sets unlimited terminal width and height see Screen Size, and acts as if 'set confirm off' were in effect (see Messages/Warnings). bash$ gdb -batch -ex foo Undefined command: "foo". Try "help". bash$ echo $? 0
Bleah. I was leaning on bugzilla's ability to suggest dupes to find this one. It didn't. Now I can't really trust it at all. *** This bug has been marked as a duplicate of bug 13000 ***