Skip to content

Exit with status 2 on bad usage#5

Merged
tdewolff merged 1 commit intotdewolff:masterfrom
dbohdan:exit-status-2
Mar 18, 2025
Merged

Exit with status 2 on bad usage#5
tdewolff merged 1 commit intotdewolff:masterfrom
dbohdan:exit-status-2

Conversation

@dbohdan
Copy link
Contributor

@dbohdan dbohdan commented Mar 18, 2025

This mimics GNU Bash built-ins and Coreutils more closely. It allows the user to tell usage and other errors apart by their exit status.

From the Bash Reference Manual:

All of the Bash builtins return an exit status of zero if they succeed and a non-zero status on failure, so they may be used by the conditional and list constructs. All builtins return an exit status of 2 to indicate incorrect usage, generally invalid options or missing arguments.

From the GNU ls(1) manual:

   Exit status:
       0      if OK,
       1      if minor problems (e.g., cannot access subdirectory),
       2      if serious trouble (e.g., cannot access command-line
              argument).

@tdewolff tdewolff merged commit 27d1de3 into tdewolff:master Mar 18, 2025
3 checks passed
@tdewolff
Copy link
Owner

Perfect, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants