Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Sep 2020 20:28:02 +0200
From:      Polytropon <>
To:        Michael Sierchio <>
Cc:        FreeBSD Questions <>
Subject:   Re: Error message output
Message-ID:  <>
In-Reply-To: <>
References:  <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Sun, 20 Sep 2020 11:19:32 -0700, Michael Sierchio wrote:
> If you know something about the error, don't just exit with any return
> value.
> *>* man sysexits

Yes, I know about that (and I tend to use it in C programs);
my examples simply contained "exit 1" as opposed to explicit
or implicit "exit 0" to _at least_ signal to the caller that
there was some error. Of course being specific with an error
code from sysexits, especially using the nice EX_* values,
is convenient from C code, but requires looking them up in
the manual in case of a sh script. :-)

I fully agree that there is nothing wrong with something

	if [ "$1" = "" ]; then
		echo "Error: Missing filename." > /dev/stderr
		exit 64

For C code, there are also the values EXIT_SUCCESS and
EXIT_FAILURE in stdlib.h with values 0 and 1 respectively,
in case sysexits.h should not be available.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

Want to link to this message? Use this URL: <>