|
From: Thomas S. <t.s...@fz...> - 2009-11-23 16:46:27
|
FlavioB wrote:
>
> ...
> Can you correct me if I'm wrong? It give 2009-11-01 because it evaluates
> the first piece of code up to "%Y"? And then it takes "-%m" and "-%d" as
> single numerical values?
>
yes, and takes 2009-11-01 as a request to calculate the result.
and it will give an error message when %d is 07, 08, or 09
(because 0x is interpreted as an octal number).
FlavioB wrote:
>
>> you need to make clear that you expect a string:
>> FIRST_DAY=system('date -d "-$(($(date +%d)-1)) days"
>> +%Y-%m-%d')
>> FIRST_DAY="`date -d "-$(($(date +%d)-1)) days" +%Y-%m-%d`"
>
> Many many thanks, but as I'm curious and willing to learn some more:
> what's the "system" word standing for?
>
http://www.gnuplot.info/docs/node336.html
http://www.gnuplot.info/docs/node327.html
FlavioB wrote:
>
> And how do I use double-quotes and/or single-quotes
> (like in your second example)?
>
that's not so easy...
the outer double quotes are needed to make clear that the
result of the 'date' command is a string:
print `date -d "-$(($(date +%d)-1)) days" +%Y-%m-%d`
1997
print "`date -d "-$(($(date +%d)-1)) days" +%Y-%m-%d`"
2009-11-01
single quotes would not work here, because then the backquotes
would not be interpreted (by gnuplot):
print '`date -d "-$(($(date +%d)-1)) days" +%Y-%m-%d`'
`date -d "-$(($(date +%d)-1)) days" +%Y-%m-%d`
the double quotes inside the backquotes are essential, single
quotes would work here (due to the expansions the shell
does):
print "`date -d '-$(($(date +%d)-1)) days' +%Y-%m-%d`"
date: invalid date `-$(($(date +%d)-1)) days'
obviously, the double quotes inside the backquotes are not
interpreted as string delimiters by gnuplot, otherwise the
string would end in between.
FlavioB wrote:
>
> Thanks again and kind regards,
> Flavio Boniforti
>
> PIRAMIDE INFORMATICA SAGL
> Via Ballerini 21
> 6600 Locarno
> Switzerland
> Phone: +41 91 751 68 81
> Fax: +41 91 751 69 14
> URL: http://www.piramide.ch
> E-mail: fl...@pi...
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gnuplot-info mailing list
> Gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
>
--
View this message in context: http://old.nabble.com/set-xrange-from-variable-tp26477602p26481739.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|