bash - Best practices on setting exit status codes -
when implementing own scripts, best practice exit different exit codes different failure scenarios? or should return exit code 1 failure , 0 success providing reason on stderr?
providing descriptive error message stderr fine , interactive users, if expect scripts used other scripts/programs, should have distinctive error codes different failures, calling script make informed decision on how handle failure.
if calling program not wish handle different failures differently check return code against > 0
- don't assume case.
Comments
Post a Comment