Rexx Vs Bash

by H. Fosdick   © 2024

For those who know one of these languages and want to learn about the other. Click here for PDF version.

The Basics

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)


DialectsTRL-2, ANSI, Mainframe, ooRexx, NetRexxBash (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 paradigmsProcedural, scripting, functional, object-oriented (ooRexx and NetRexx)Procedural, scripting, functional
OOP: classes, objects, multi-inheritance, polymorphism, encapsulationIn ooRexx and NetRexxUnsupported
User GroupRexx Language Association Free Software Foundation
Quick Online LookupQuick Lookup DevHints, LinuxTutorials
Cheat Sheet
(printable PDF)
ANSI Rexx, Mainframe Rexx LinuxSimplify, Cheatography
ForumRexxLA forum,
Further Free Software Foundation: GNU Bash

Language Comparison

 ANSI RexxBash
FormattingFree formFree form
CommentsEnclose 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 BlocksDefine by do - endDefine by do - done, if - fi, or case - esac
Undefined VariablesAllowed. Use SYMBOL to determine if a variable has been definedAllowed. 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 OperatorsUse built-in functions &  |  ^  <<  >>  ~
Compound:  &=  |=  <<=  >>=  ^=
Membership OperatorsUnsupported Unsupported
Regular ExpressionsUse RexxRE Regular Expressions external Library Yes
Built-in FunctionsAbout 70 functions None in the traditional sense, designed to issue shell and line commands
Data TypesEverything'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 Typedatatypedeclare -p
Collections of VariablesUse compound variablesOne-dimensional arrays:
declare -a array_name
Associative ArraysUse compound variablesdeclare -A array_name
Multidimensional ArraysUse compound variablesUnsupported
Stack & Queue OperationsYes (push, pull, parse pull, queue, queued)No generalized facility (offers a directory stack with pushd, popd, and dirs)
Decimal ArithmeticDefaultInstall and use: bc
Flow of Controlif, do, select, call, exit, return, iterate, leave, signal, nop until, while, for, break, continue, return, exit
Trace Script Executiontrace (instruction), trace (function) Use the -x option. Run the script: bash -x
or inside the script: set -x
Terminate Processexitexit
Get User Inputsay "Enter your name:"
parse pull name
echo -n "Enter your name: "
read name
Exception Handlingsignaltrap
Standard Exceptionsnovalue, error, failure, halt, notready, syntax, lostdigits trap covers 64 signal specs
(list them by: trap -l)
Run an Operating System CommandJust 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    .     .