Skip to content

Files

Latest commit

 

History

History
26 lines (16 loc) · 553 Bytes

SC2242.md

File metadata and controls

26 lines (16 loc) · 553 Bytes

Pattern: Malformed exit

Issue: -

Description

exit can only be used to signal success or failure (0 = success, 1-255 = failure). It can not be used to return string data, and it can not be used to print error messages.

String data should be written stdout, before an exit 0 to exit with success.

Example of incorrect code:

exit "Bad filename"

Example of correct code:

echo "Bad filename" >&2
exit 1

Further Reading