PreviousUp

5.5.59  Set the exit status of a Mythryl script or program

Posix/Linux/Unix systems traditionally allow a program on exit to return a status value in the range 0-255, which may then be examined by the calling program. The standard convention is that successful programs and scripts return a zero exit status, while nonzero values indicate failure. (There is no general convention as to what different nonzero status values mean.)

In Mythryl, as in most languages, the exit status is specified as an integer argument to the exit function; it may be checked in most shells by examining the $? special variable:

    linux% cat myscript
    #!/usr/bin/mythryl
    exit(13);

    linux% ./myscript; echo $?
    13

Mythryl programs are expected to emphasize clarity over brevity to a greater extent than Mythryl scripts, so in a Mythryl program instead of calling exit(13) one would usually call

    winix::process::exit( 13 );

Comments and suggestions to: bugs@mythryl.org

PreviousUp