These six ARexx scripts have proven to be of great use, to me. They are
primarily to be used as functions from other ARexx scripts:
COMMAND( CMD )
Executes a command, CMD, and return the output. The command output
is run through a PIPE: stream. (NOTE: If the program generates no
output, COMMAND() can get stuck.)
say compress( command( 'list rexx:command.rexx' ), 'ex' )
==>
Dirctory "r:" on Tusday 11-Apr-95
command.r 431 ----rwd 29-Jan-95 03:51:58
1 fil - 2 blocks usd
GETENV( VAR )
Retrieves a given ENV: VAR for you.
say getenv( 'user' ) ==> rkr
GETFILE( FILE )
Reads the contents of a FILE.
say getfile( 'env:user' ) ==> rkr
PUTFILE( CONTENTS, FILE )
Stores CONTENTS into a FILE.
say putfile( 'test', 'ram:test' ) ==> test
REPLACE( SRC, OLD, NEW )
Scans SRC and changes all OLD with NEW. The result string is
returned.
say replace( 'abc', 'b', 'bb' ) ==> abbc
SETENV( CONTENTS, VAR, ENVARC )
Stores CONTENTS into the ENV: var, VAR. If you pass a 1 in for
ENVARC, it also writes the data to the ENVARC: copy of the VAR.
say setenv( 'rkr', 'user', 1 ) ==> rkr
These 6 recur enough that it seems silly to rewrite them in every script I
write, but not so often/centrally that it's worth taking the time to create
a proper .library for them.
I'm posting them seperately as I hope to shortly release a set of archives,
somewhat independant, but all of them hinging, to one degree or another, on
these six scripts for occasional support. Who knows, you might even find
your OWN uses for them. (^&
|