Skip to content
Vidar Holen edited this page Nov 25, 2018 · 1 revision

The exit status can only be one integer 0-255. Use stdout for other data.

Problematic code:

exit foo bar

Correct code:

echo foo
echo bar
exit

Rationale:

In bash, exit can only be used to signal success or failure (0 = success, 1-255 = failure).

To exit with textual or multiple values from a function, write them to stdout and capture them with command substitution instead.

See SC2242 for more information.

Exceptions:

None

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally