|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
|||
NetRexx Programming
Quote:
|
|
|||
Does Rexx take long to learn?
I was half considering scouting around for a new scripting language, having an aversion to bourne shell for scripts longer than a few lines. Perl's fine or more than fine for a lot of things, of course, but unless I'm missing something, when you want to run Unix commands you have to make a call to system, which isn't much improvement over C in terms of brevity. Okay, when you're taking in the output of a command you have backticks and the open function, but sometimes you simply want to run a program and let it use stdout, stderr, and stdin rather than redirect them. I like scsh for this, and like lisp, but it's barely maintained. I think there's not even really a solid amd64 build yet. I noticed a paper about something called Shcaml, based on ML, but though the idea of bringing static typing to shell scripting is appealing, unless I mistook the syntax, the notation for running a command isn't brief like /bin/sh or scsh, but inelegantly has you precede each one with command, giving the same notation problem (I think) Perl has. Maybe Rexx would fit the bill. Otherwise, has anyone tried plan 9's rc as a substitute to bourne, anyone who finds notations like 1>&2 or ${what%%the} squirrely? |
|
|||
Given your exposure to other languages, you shouldn't experience an undue learning curve. Rexx is similar in syntax to Modula-2 or Ada -- in other words, Pascal-ish.
Rexx comes from the IBM world circa 1970s' - '80's. As I recall, it was developed in the branch office in England, & proliferated to the point of becoming IBM's glue language used on all supported platforms. Flexible? Yes, but I don't think it ever gained much traction outside of the IBM world. In fact, I haven't heard much about Rexx ever since OS/2 faded into the sunset. There are a number of tutorials which can be found online; one place to begin is Wikipedia's article: http://en.wikipedia.org/wiki/Rexx One of the more concise implementations of Tic-Tac-Toe I saw in one of Cowlishaw's books, but if I am recalling correctly, this wasn't necessarily due to anything inherent to Rexx, it simply was a nice, short implementation. Quote:
|
|
|||
There are three different implementations of Rexx available for many platforms today. Classic Rexx which was originally developed in 1979 and later Object Rexx which has become ooRexx in the open source world, and in the early 1990s, NetRexx which allows one to use all of the Java class libraries.
The most popular Classic Rexx is Regina This is the homepage of ooRexx and a link to sourceforge to download The NetRexx homepage All of them are actively maintained and ooRexx is currently in 4.1.3 beta. ooRexx is upwards compatible and can run all Classic Rexx code, and one can mix object oriented code with procedural code. I've used ooRexx to run Classic Rexx code, but find the syntax odd (for me) for oo programming. There is also ooDialog for Windows programming. As asked, to run a system command in Rexx simply do this in your Rexx source: Code:
'ls /tmp/junk' $ rexx /tmp/ls.rex a b Code:
string = '/path/to/filesystem host1(sync,rw,fsid=1) host2(sync,ro,fsid=2 host3(sync,ro,fsid=3) host4(sync,rw,fsid=4)' do while string <> '' parse var string fs '' server '(' opts ')' string say opts end # rexx /tmp/exports.rex sync,rw,fsid=1 sync,ro,fsid=2 sync,ro,fsid=3 sync,rw,fsid=4 Code:
host = InetAddress.getlocalHost() parse host name '/' ip say host say 'HOST:' name say 'IP: ' ip # java hostn myserver/192.168.1.100 HOST: myserver IP: 192.168.1.100 I use both Rexx and NetRexx almost daily for my work as a Unix admin at a fortune 500 company. I've also used NetRexx for servlets. The syntax is slightly different for the two, such as for arrays in Rexx one would do Code:
book.0=3 book.1='title1' book.2='title2' book.3='title3' do i=1 to book.0 say book.i end $ rexx /tmp/book.rex title1 title2 title3 Code:
method main(args=String[]) static book = Rexx('') book[1]='title1' book[2]='title2' book[3]='title3' loop i=1 to 3 books=book[i] say books end $ java books title1 title2 title3 Code:
method main(args=String[]) static books=0 books[1]='title1' books[2]='title2' books[3]='title3' loop i = 1 while books[i] <> 0 say books[i] end $ java books title1 title2 title3 RexxLA also has an annual symposium. Next year it is to be held in Austin, Texas. I have successfully built Regina on FreeBSD, NetBSD, OpenIndiana and SmartOS. I believe I also built it on OpenBSD but am not positive; although since it built on FreeBSD and NetBSD there is no reason to believe it would fail. Open Object Rexx (ooRexx) runs on a number of platforms, but I have been unsuccessful in getting it to build for NetBSD, FreeBSD, OpenIndana and SmartOS. There is an older 3.2 version of ooRexx already built for Solaris that does run on OI and SmartOS though. NetRexx will run if you have Java installed. Copy NetRexxC.jar to JAVA_HOME/lib and add it to your CLASSPATH, then copy nrc to PATH and you are set. Last edited by gpatrick; 27th June 2013 at 01:00 PM. |
|
|||
Thanks for the info everyone.
Now I'm torn whether to try rc or rexx first. rc appears to address some of the things that make me twitch about /bin/sh too and has some interesting features besides: http://doc.cat-v.org/plan_9/4th_edition/papers/rc |
|
|||
I used to program in it in the last nineties when I worked in IBM. It was easy to learn and use, but for some reason did not catch in the M$ world, so when OS/2 failed...
I used it to glue C programs and DB2 calls. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
php programming in openbsd. | bsdnewbie999 | OpenBSD General | 5 | 15th June 2009 03:03 AM |
c programming - Modules | corey_james | Programming | 3 | 6th November 2008 08:49 PM |
Learning Programming | Crypt | Programming | 35 | 27th October 2008 04:54 PM |
GUI Programming | bsdnewbie999 | Programming | 6 | 17th August 2008 12:19 AM |
C programming - Lint | corey_james | Programming | 14 | 16th May 2008 11:05 PM |