Some time ago, I was lamenting that Bash did not have something comparable to PARSE found in Rexx / Open Object Rexx. Shortly I received a reply from Dallas Legan that he had built a tool capable of exposing the power of PARSE and allow it to be used within Bash scripts. That concept totally rocks! That tool may be found here:
"A Simple, General Command Line Filter In REXX"
http://www.scoug.com/os24u/2001/scoug010.parsetool.html
The way I put it to use is for extracting and acting upon the final "return code" of an executed program which is itself creating a log file and included on the last line the program's exit code.
Log file example:
Purging Old Backups...
Finished Purging!
backup.sh complete! RC=0
Bash script usage example:
So by processing the last line of the log file with Rexx's PARSE, I can cleanly extract just the numeric value which RC= states as the exit of that script. The bonus is that I can use PARSE's syntax which I am used to within Bash!
One minor problem crept into this pretty picture. When ooRexx 4.0.1 was released, it had a bug that prevented the PARSE script from working properly. I arrived at a slight modification to the script that gets around the bug in ooRexx 4.0.1. You may download / apply my patch file here: