Re: Catching output from RUN command (4GL)
Posted in 1993
In article <C1D1pp.AA0@dircon.co.uk> uaa1006@dircon.co.uk (Peter Miles) writes:
>
>Does anyone know if there is any way of capturing the output
>of a command run by the 4GL RUN command into an Informix 4GL
>variable?
>
>EG I want to say something like:
>
>LET string=RUN "tail -1 /tmp/somefile"
>
>The output I want to catch will always be only one line long.
>I'm running i4gl version 4 (standard engine).
>
>Comments and suggestions gratefully received!
You can always do something (kind of klugey!) like this :
run "tail -1 /tmp/somefile > /tmp/t1"
run "paste -d'|' /tmp/t1 /dev/null > /tmp/t2"
### (i.e. stick a "|" onto the end of your one-line file)
create temp table temp1 ( a char(80) )
load from "/tmp/t2" insert into temp1
select a
into string_var
from temp1
drop table temp1run "rm /tmp/t1 /tmp/t2"
I have done this kind of thing, and it does work.
Paul