I'd like to pull something off with AREXX but doesn't seem toi get it tow ork the way i want.
Here's the thing...i know about opening/reading/writing of files in AREXX, but can i catch output from an externally started program wihout the need of those file I/O?
This is what i'd like to achive:
test=ADDRESS COMMAND "version"
The above is just an example.
I don't think this is possible, but please prove me wrong.
I played around with quotation marks, but it doesn't seem to execute the command, unless i leave out the test= part, but then output obviously goes into console.
Is it possible in AEXX (maybe with a workaround or trick) or do i have to go the file I/O way either way? I want to produce as less overhead as possible as this script should go (if it ever works) into network startup, so it shouldn't do too much I/O to keep the error margin as small as possible.
Realistically, writing and reading a file in RAM: is not going to be noticable in terms of overhead, and it is the most normal solution for this, but I get your point.
An alternative which might seem a bit more clean (if you don't look behind the scenes) is to use C:RxSet and the ARexx GetClip() function.
@Raziel Not exactly sure what you want but in an AmigaDOS script you can do this:
;AmigaDOS script Set vers `version` echo $vers
Note that the characters that look like single quotes are actually the character in the key to the left of the 1 key on most keyboards. The key has a ~ char with a ` char below it.
Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450
What i want to achieve is reading in a fraction of a website with cURL and process that further on in the AREXX script, but without the need of saving the string to a file first.
You probably won't benefit from RxSet then, nor probably using SetEnv or similar, because I assume you will be dealing with multiline data (such as HTTP headers). RxSet and SetEnv will only save the first line of the input.
If so, my best advice would be to simply redirect the output of curl into a file in RAM: and then read that file from ARexx and close and delete it afterwards. I think one or some of the third-party support libraries (rexxtricks? RMH? rexxarplib?) have a function to read a complete file into a stem variable, one line per stem, which might make this option a bit more neat for you. But I can't ATM see a way around a file.
BTW, you may already know this, but if you want to make sure you can run multiple copies of your script simultaneously, make the result of a PRAGMA('I') part of your temporary filename - this will make it unique.
Your DO needs to be paired with and END before the ELSE.
Since the ELSE branch only contains one statement, it's optional to wrap that in another DO/END pair, but I usually do it myself (just as I also use curly brackets in C/JS etc. even for a one-line branch). It's probably mostly a matter of taste.
But the main thing is: If you have a DO, then you need to end it with an END.
The only solution would be not to use curl and get your file directly from Arexx. You can have an idea of how it works reading the sources of W3S, the Arexx web server.