Home > Software design >  start bash with last exit code of 0
start bash with last exit code of 0

Time:11-08

When I start a new bash shell, if I run the command echo $? as the first thing, I get 1. How can I run bash with the "default" exit code being 0?

Context: I am running msys2 in a terminal window in VS Code. If I start msys2, and then realize I didn't need a shell now and just type exit, bash exits with 1, causing VS Code to pop up an annoying warning.

CodePudding user response:

Most likely something in your profile is failing and setting the status code to 1. Since status codes are overwritten by each process that runs, it'll probably be something towards the end.

  • Related