Results 1 to 4 of 4

Thread: exit status

Hybrid View

  1. #1

    exit status

    I shell scripting what does the exit -1 means?

  2. #2
    Who wrote the script? Meaning of non-zero exit is often attributed by the author.
    Some standard definitions are usually located in errno.h
    You can find this, e.g. at /usr/include/asm-generic/errno.h

    Now, -1 is a special number because in two's complement binary representation it corresponds to all 1's (255 for an 8 bit integer)
    I think it usually corresponds to "unknown error," though I may be totally mistaken.

    If you're a C programmer, the "perror()" function will
    print the traditional meaning of an error code for you and "strerror()" will return it as a string.

    Here's some quick (not guaranteed to be perfect) example code:
    Code:
    #include <stdio.h>
    #include <string.h>
    
    int main(int argc, char* argv[]) {
        int i;
    
        for(i=1;i<argc;i++)
            printf("%d: %s\n",atoi(argv[i]), strerror(atoi(argv[i])));
        return 0;
    }


    References:
    `man errno`
    http://www.gnu.org/s/bash/manual/htm...it-Status.html
    Last edited by countach44; 12-16-2011 at 04:08 PM. Reason: spelling, added example code
    63,000 bugs in the code, 63,000 bugs,
    ya get 1 whacked with a service pack,
    now there&#039;s 63,005 bugs in the code!!

  3. #3
    sure, I dint write the script, I was going through the script and noticed exit -1 in the code and I am unable to figure it out how and what it does.. Still I am in confusion

  4. #4
    Is the script in bash? Running it with "bash -x" will give more detail about what it's doing (you'll probably want to redirect output to less, e.g. bash -x script.sh | less).
    If you can find a snippet of relevant code and post it, maybe someone here can help you out.
    63,000 bugs in the code, 63,000 bugs,
    ya get 1 whacked with a service pack,
    now there&#039;s 63,005 bugs in the code!!

Similar Threads

  1. IRC Status 07-22-02
    By Spot in forum Announcements and Suggestions
    Replies: 80
    Last Post: 02-28-2004, 04:01 AM
  2. IRC status 06-13-02
    By Spot in forum Announcements and Suggestions
    Replies: 4
    Last Post: 07-07-2002, 09:25 AM
  3. Status
    By mugs in forum Announcements and Suggestions
    Replies: 9
    Last Post: 06-26-2002, 09:59 AM
  4. exit from su
    By Black666 in forum Linux - General Topics
    Replies: 3
    Last Post: 05-29-2002, 10:05 PM
  5. Stuck in XF86Setup GUI - how to exit?
    By Phaete in forum Linux - General Topics
    Replies: 2
    Last Post: 04-19-2002, 10:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •