bash force set exit code to 0 code example Example: bash force exit 0 function a() { ls aaaaa 2>&1 return 0 } a echo $? # prints 0