Home

exit0

exit0, or an exit code of 0, refers to the conventional value returned by a program to indicate successful termination. Exit statuses communicate the outcome of a process to its parent process, the operating system, or a calling script.

In POSIX and most Unix-like environments, the exit status is an 8-bit value; 0 signifies success, while

In C and related languages, programs typically return 0 from main, or use the EXIT_SUCCESS macro, to

Usage and implications: scripts examine a command’s exit status (for example, in Bash, the special variable $?

See also: exit status, exit code, status code.

non-zero
values
indicate
errors
or
abnormal
termination.
Shells
and
many
programming
languages
follow
this
convention.
Common
non-zero
codes
include
1
for
a
general
error
and
127
for
command
not
found;
126
can
indicate
a
command
that
cannot
be
executed.
Some
systems
encode
the
cause
of
termination
by
signal
numbers,
where
128+n
indicates
termination
due
to
signal
n.
signal
success,
while
EXIT_FAILURE
or
non-zero
values
indicate
failure.
The
exact
numeric
meanings
of
non-zero
codes
are
not
standardized
across
all
programs;
they
are
defined
by
each
program.
holds
the
last
command’s
exit
code).
Continuous
integration
and
build
systems
rely
on
exit
codes
to
determine
whether
a
step
succeeded.
While
0
is
widely
interpreted
as
success,
some
programs
may
have
nuanced
semantics;
it
remains
best
practice
to
return
0
only
on
successful
completion.