Re: shell error codes

From: gregg (greggory_at_netJUSTSAYNOcourrier.com)
Date: 11/07/04


Date: Sun, 07 Nov 2004 20:40:23 +0100

Barry Margolin wrote:

> The shell doesn't report error codes, it reports the exit status of
> programs. These are not standardized, except that 0 means success and
> anything else is considered failure.

I agree to that when a program is launched by the shell.
But what of:

gregg@darkstar [0] ~$ ./jkkkl
bash: No such file or directory
gregg@darkstar [127] ~$

Here, "127" is for "no such file or directory", i.e "ENOENT"

What I want is to associate those integer values with their errno
counterpart. Some are C-ANSI defined, others Posix.1 (as I gather from
manpages).
Heck. I just wanted to understand what went wrong with error code
returned to the shell (not specific values returned by external
programs, which, as you have rightfully stated, may be whatever the
programmer decided it would; but those values the shell itself uses when
not finding a command, a file, or whatever...)

I suppose I'll have to read a bit of that Posix.1 paper just to get the
application Error value <---> ERRNO name
For I couldn't find it in the manpage (man 3 errno lists E codes all
right, but without giving their actual int value)

Anyway, thanks a lot
++



Relevant Pages

  • Re: Getmac reports ERROR Provider type not defined.
    ... If it is failing in your code, check out WSAGetLastError for the error code. ... my shell can't connect to another pc. ... >> Do you use you customer script to work with netsh? ...
    (microsoft.public.windowsxp.embedded)
  • Re: I dont understand the errors on this fork/exec
    ... First error code:: Success ... How come the first perror() prints 'Success'. ... perrorcan change the value of errno. ...
    (comp.unix.programmer)
  • Re: Trying to join an already exited pthread
    ... program are valid for Linux but not for FreeBSD. ... Hence error code 2. ... A component of a specified pathname did not exist, ... I was just being lazy by checking errno, instead of checking the return value of pthread_*. ...
    (freebsd-questions)
  • Re: PTHREAD_SCOPE_PROCESS on Linux
    ... I've tried the following code on Ubuntu 8.04.1 and Fedora 9. ... It dies ... errno does not contain useful information after any pthread_* call, ... the return value from the call is the error code. ...
    (comp.programming.threads)
  • Re: File exist
    ... You can try reading `errno` do get to the error code, ... implementation error codes/messages is more likely than not to make ... (Discussion in comp.os.linux.misc on the intuitiveness of commands.) ...
    (comp.lang.c)