[gradsusr] bash command in gs, capture the result
claudiomet
claudiomet at gmail.com
Thu Jul 5 18:49:59 EDT 2012
There is a problem: My example script, using getenv command provided by gex, is:
------<script.gs>--------------------
'open file.ctl'
'set lat -30'
'set lon -69'
'set t 2'
'd t2'; tempkelvin=subwrd(result,4)
* the line below is Bash on grads script, it starts with exclamation
'!let celsius='tempkelvin'-273; echo ${celsius}; export celsius'
'getenv celsius'
------<script.gs>--------------------
But the result is:
"Enviroment variable celsius = <undef>"
The variable is correctly printed in screen through echo command, but
is not exported to the enviroment, and I can't get it into grads
script ¿what can be the problem?
2012/7/5 Becker, Bernd <bernd.becker at metoffice.gov.uk>:
> Have a look here :
>
> http://opengrads.org/doc/udxt/env/
>
>
> --
> Bernd Becker Climate Impacts Product Development
> Met Office Hadley Centre FitzRoy Road Exeter Devon EX1 3PB United
> Kingdom
> Tel.: +44 (0) 1392 884511 Fax: +44 (0)870 900 5050
> E-mail:bernd.becker at metoffice.gov.uk -
> http://www.metoffice.gov.uk/research/our-scientists/seasonal-to-decadal/
> bernd-becker
> http://www.metoffice.gov.uk/news/releases/archive/2011/weather-game
>
> -----Original Message-----
> From: gradsusr-bounces at gradsusr.org
> [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of claudiomet
> Sent: 04 July 2012 23:17
> To: GrADS Users Forum
> Subject: [gradsusr] bash command in gs, capture the result
>
> Hi Users !
>
> I need to execute a bash command inside of a grads script the result of
> this bash command must be a grads script variable for example (an stupid
> example):
> -------------
> 'open file.ctl'
> 'set lat -30'
> 'set lon -69'
> 'set t 2'
> 'd t2'; tempkelvin=subwrd(result,4)
> * the line below is Bash on grads script, it starts with exclamation
> '!let celsius='tempkelvin'-273; echo ${celsius}'
> --------------
> Stupid example but, and I need to capture the ${celsius} Bash variable
> for use in the grads script.
> I don't know how to make it without using an intermediate text file, the
> use of a text file is extremely slow for my purposes.
> Best regards!
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
--
Claudio Cortes
Meteorologo, Ingeniero de proyectos
Micomo S.A. Filial Codelco
Unidad de Negocios Ambientales
www.micomo.cl
---
Claudio Cortes
Meteorologist, Project Engineer
Micomo S.A. Codelco Subsidiary
Environmental Business Unit
www.micomo.cl
More information about the gradsusr
mailing list