[gradsusr] shell command within grads script

Davide Sachetti davide.sacchetti at arpal.liguria.it
Tue Oct 20 03:11:27 EDT 2020


the simplest way is to redirect shell output to a file (!date >/tmp/x),
then read it (http://cola.gmu.edu/grads/gadoc/script.html)

in opengrads there is at least one extension (I wrote one) that gets
the output of external commands, but if you don't know about extensions
the first solution may be faster to implement

Bye bye
Davide

On Mon, 2020-10-19 at 17:26 -0400, Muthuvel Chelliah - NOAA Federal
wrote:
> Semyon, Jeff,
> 
> Thanks for the replies.
> 
> a) I know that the date command with the options I had asked, will
> give the
> result at the grads command line with a ! before that command.
> 
> b) I also know the second round about way my manipulating the output
> from the q time output (but how to do few days ago?).
> 
> I was only curious if there was a way from a) above, of possibly
> storing 
> that output in a variable as part of a grads script variable itself.
> I guess, it is difficult, and not doable!! 
> 
> Thanks again
> Muthu
>  
> ------------------------------------------------
> Dr. Muthuvel Chelliah, eMail: Muthuvel.Chelliah at noaa.gov
> Rm. 3008, Climate Prediction Center, Ph: (301) 683-3393
> NCEP/NWS/NOAA/U.S.Dept.of Commerce,
> 5830, University Research Court, NCWCP,
> College Park, MD 20740
> 
> 
> On Mon, Oct 19, 2020 at 4:54 PM Jeff Duda <jeffduda319 at gmail.com>
> wrote:
> > You can try prompting the linux command with "!" and hopefully the
> > script recognizes the result and stores it properly.
> > 
> > I see that you're attempting to do something that would require
> > lots of code in a grads script, but hopefully you know that you can
> > query the valid time of data using 'q time' and parse the data
> > using the 'sublin()', 'subwrd()', and 'substr()' functions internal
> > to GrADS' scripting language.
> > 
> > Jeff Duda
> > 
> > On Mon, Oct 19, 2020 at 1:56 PM Muthuvel Chelliah - NOAA Federal <
> > muthuvel.chelliah at noaa.gov> wrote:
> > > Hello folks,
> > > 
> > > How can I set the result of the following linux shell command
> > > to a variable (time_var) within a Cola grads script? which can be
> > > assigned
> > > to set time command, via 'set time 'time_var
> > > 
> > > date -d "3 days ago" +%d%b%Y
> > > 
> > > Thanks
> > > Muthu
> > > ------------------------------------------------
> > > Dr. Muthuvel Chelliah, eMail: Muthuvel.Chelliah at noaa.gov
> > > Rm. 3008, Climate Prediction Center, Ph: (301) 683-3393
> > > NCEP/NWS/NOAA/U.S.Dept.of Commerce,
> > > 5830, University Research Court, NCWCP,
> > > College Park, MD 20740
> > > _______________________________________________
> > > 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



Attenzione ARPAL ha cambiato indirizzi digitali, i nuovi indirizzi di e-mail sono composti dall'attuale nome.cognome seguito da @arpal.liguria.it, quindi nome.cognome at arpal.liguria.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20201020/c788f5f2/attachment-0001.html>


More information about the gradsusr mailing list