Capture shell output

Jean Pierre Arabonis arabonis at EGS.UCT.AC.ZA
Sun Jun 14 11:14:24 EDT 2009


Hi there - the only way I have found is to output the result to a file
then use the read function to read the file.

    JP


P.R. wrote:
> Is it possible to capture stdout from a shell command?
> Im trying to do the following within a grads script (in a linux shell
> environment)?
>
> * use linux shell's 'date' function to process time...
> 'q time'
> tc=subwrd(result,3)
> '!date -u -d 'tc' +"%Y%m%d %H%M%S"'
>
> * this doesn't work; result is empty
>
> say 'res: 'result
>
> ymd=subwrd(result,1)
> hms=subwrd(result,2)
> say 'ymd: 'ymd
> say 'hms: 'hms
>
> Can anyone please confirm this, or provide a work-around to be able to
> retrieve&save stdout from a shell command?
>
> Thanks,
> P.Romero
>
>


--
Jean Pierre Arabonis
arabonis at egs.uct.ac.za
Tel 021 780 1021 cell 084 401 1365
This email is 100% Microsoft Free



More information about the gradsusr mailing list