Comments on: Quit/Return for Exit Codes
REBOL Technologies

Comments on: Quit/Return for Exit Codes

Carl Sassenrath, CTO
REBOL Technologies
7-Oct-2004

Article #0005
Main page || Index || Prior Article [0004] || Next Article [0006] || 1 Comments || Send feedback

Now that redirection is fixed, it's time to add exit codes as well. In systems like Unix (Linux/BSD) exit codes allow REBOL programs to return their "exit status" to the command shell. This is a common practice in shells, and it is very useful if you want to combine your REBOL programs with other types of Unix commands and scripts. We've needed this for some time in REBOL, and quite frankly I'm surprised we ignored it for so long. (I've wanted this for my own Linux scripts for years.)

As an example, suppose you need a simple Linux shell script that executes a non-REBOL command (like a MAKE) depending on the results of a REBOL program. The shell script might look like this:

if (./rebol check-files.r) then
    make driver
fi

If REBOL returns a "success" exit code, then the MAKE program will be executed. Otherwise, it will not.

In Unix-style shells, a success code is the integer value zero. Non-zero values are normally used to indicate errors or other types of events. To return an exit code from REBOL, use the QUIT function. The line:

quit/return 10

will return an exit code of 10. The /return refinement was picked because it is related to the BREAK form:

break/return value

Note that if your REBOL program just does a QUIT, or does no QUIT but simply exits off the bottom, a zero exit code (success) will be returned to the shell.

Alpha versions of REBOL that contain this function and the redirection changes below will be available for Linux and OpenBSD later today.

1 Comments

Comments:

what did he smoke
2-Aug-2011 7:04:18
fyi. LUA is used by more organizations (commercial , public or educational) than Rebol, just to name a few :- PETROBRAS ( petro brazil - largest company in South America continent) , ADOBE, Social Media Press, CSTUG, Pontifical Catholic University of Rio de Janeiro . Also Lua has been featured in ACM publications and presented at ACM meetings. Lua can also run on Apple's mobile devices as well as android mobile devices in addition to regular devices and os

how does Rebol compare to that ?

Every body knows that REBOL has no future and a dead end. I know it hurts bad to learn that something that one has spent decades on has no future.

RED is a NEW language inspired by Rebol, IT IS NOT REBOL. (see DOC KIMBEL's documentation for clarification about the language and the pictures of Rebol "before" and 'where it is now"

similarly JAVA is inspired by C++ but is not C++.

RUBY is inspired by PERL, SMALLTALK but is NOT PERL, SMALLTALK.

C# is inspired by JAVA, but is NOT JAVA. Almost anyone can give you tons of other examples.

to go around saying that JAVA is C++ or RUBY is PERL, SMALLTALK is absurd. same applies to RED.

people who want to see, open their eyes

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

CS-0005


Comment:


 Note: HTML tags allowed for: b i u li ol ul font p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 27-Sep-2023   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code