bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] working with )HOST


From: Christian Robert
Subject: Re: [Bug-apl] working with )HOST
Date: Sat, 5 Mar 2016 01:06:07 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

Use a function like this one to execute a host command and get the result into 
a variable.
ps: still debugging this one.


      ∇Execute[⎕]∇
    ∇
[0]   z←Execute cmd;⎕io;fh
[1]   ⎕io←0
[2]   fh ← ⎕FIO[24] cmd
[3]   z←⎕av[⎕fio [8] fh]
[4]  Loop: →(0≠⎕FIO[10] fh)/Fini
[5]   z←z,⎕av[⎕fio [8] fh]
[6]   →Loop
[7]  Fini: ⎕FIO[25] fh
[8]   ⊃⊃z
    ∇

On 2016-03-04 21:54, address@hidden wrote:
Hi Bug-apl,

Currently, at a point in my code I do something like this:

⍝assume the variable 'yadda' exists and is correctly formed, as well as the 
read_file function
success←yadda ⎕fio[7] tie← 'wr'⎕FIO[3] "yadda.file"
)host ./shellscript.sh <http://shellscript.sh> yadda.file yadda.file.new
yadda_new← read_file "yadda.file.new"
⍝end of code

My question is: is there either 1. a way to feed )host a variable (I don't 
think that is possible) or 2. a better way to implement this task in its 
entirety. I find it a small nuisance that I have to write and then read a file 
in my code to access non-APL stuff for processing.

-Alex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]