by H. Fosdick © 2024 RexxInfo.org
For those who know one of these languages and want to learn about the other. Click here for PDF version.
Rexx | Bash | |
---|---|---|
Easy to learn, use, and maintain | Yes | No (unfriendly syntax) |
Very powerful | Yes | Yes |
Open source | Yes | Yes |
Portable | Yes | Yes |
Runs on all platforms | Yes | Yes |
Runs as the OS Shell | No | Yes |
Interfaces to tons of tools | Yes | Yes |
ANSI or ISO Standard | Yes (ANSI-1996) | Yes (POSIX compliant with extensions) |
Rexx | Bash | |
---|---|---|
Dialects | TRL-2, ANSI, Mainframe, ooRexx, NetRexx | Bash (a superset of the Bourne shell) |
Unique Usage | * Default scripting language for mainframes and several minor platforms
* Interfaces to all mainframe environments and address spaces |
* Default scripting language for Linux (including on Windows and mainframe Linux systems)
* Sometimes the default for BSD, Oracle Solaris, older Apples, other systems |
Programming paradigms | Procedural, scripting, functional, object-oriented (ooRexx and NetRexx) | Procedural, scripting, functional |
OOP: classes, objects, multi-inheritance, polymorphism, encapsulation | In ooRexx and NetRexx | Unsupported |
User Group | Rexx Language Association | Free Software Foundation |
Quick Online Lookup | Quick Lookup | DevHints, LinuxTutorials |
Cheat Sheet (printable PDF) | ANSI Rexx, Mainframe Rexx | LinuxSimplify, Cheatography |
Forum | RexxLA forum | LinuxQuestions.org, Linux.org |
Further information | RexxInfo.org | Free Software Foundation: GNU Bash |
ANSI Rexx | Bash | |
---|---|---|
Formatting | Free form | Free form |
Case-sensitive | No | Yes |
Comments | Enclose inside /* and */ | Start comment with: # Or, use a Here document for commenting out multiple lines |
Line Continuation | , (comma) | \ (backslash) |
Statement Separator | ; (semi-colon) | ; (semi-colon) |
Code Blocks | Define by do - end | Define by do - done, if - fi, or case - esac |
Undefined Variables | Allowed. Use SYMBOL to determine if a variable has been defined | Allowed. To error on undefined variables, code: set -u |
Assignment Operators | = | = += -= *= /= %=
Compound Bitwise: &= |= <<= >>= ^= |
Arithmetic Operators | + - * / % ** // | + - * / % **
Compound: += -= *= /= %= Evaluate arithmetic expression: $((expression)) Increment/decrement a value: i++ i-- ++i --i |
Comparison Operators | == \== >> << >>= \<<
<<= \>> = \= <> ><
> < >= \< <= \>
( \ can be replaced with ¬ in any of these) |
Integers: -eq -ne -gt -ge -lt -le
Strings: = == != > >= < <= =~ |
Logical Operators | & | && \ (prefix) ¬ (prefix) | && || ! (prefix) |
Concatenation Operators | || Or, concatenate with blank between
Or, concatenate by abuttal (no blank) |
+= Or, use abuttal: VAR3="$VAR1$VAR2" |
Bitwise Operators | Use built-in functions | & | ^ << >> ~
Compound: &= |= <<= >>= ^= |
Membership Operators | Unsupported | Unsupported |
Regular Expressions | Use RexxRE Regular Expressions external Library | Yes |
Built-in Functions | About 70 functions | None in the traditional sense, designed to issue shell and line commands |
Data Types | Everything's a string, types are reflected in usage | By default, variables are untyped. Or use "declare" to explicitly type them as: -a, -A, -i, -l, -n, -r, -t, -u, -x |
Function to Check Data Type | datatype | declare -p |
Collections of Variables | Use compound variables | One-dimensional arrays: declare -a array_name |
Associative Arrays | Use compound variables | declare -A array_name |
Multidimensional Arrays | Use compound variables | Unsupported |
Stack & Queue Operations | Yes (push, pull, parse pull, queue, queued) | No generalized facility (offers a directory stack with pushd, popd, and dirs) |
Decimal Arithmetic | Default | Install and use: bc |
Flow of Control | if, do, select, call, exit, return, iterate, leave, signal, nop | until, while, for, break, continue, return, exit |
Trace Script Execution | trace (instruction), trace (function) | Use the -x option. Run the script: bash -x
or inside the script: set -x |
Terminate Process | exit | exit |
Get User Input | say "Enter your name:" parse pull name | echo -n "Enter your name: " read name |
Exception Handling | signal | trap |
Standard Exceptions | novalue, error, failure, halt, notready, syntax, lostdigits | trap covers 64 signal specs (list them by: trap -l) |
Run an Operating System Command | Just issue the command string (Rexx passes unrecognized strings to the default active environment) | Just issue the command string |
Based on Rexx Programmer's Reference and Bash Reference Manual version 5.2.
Back to RexxInfo.org