Hi all,
Another problem to do with (I suspect) dates not be treated as dates.
My script has this block at the front to set some variables, so that I can eventually run it from a regular cron job:
startmonth=date +%m
startyear=date +%Y
endyear=$startyear
friendlymonth=date +%b
reportperiod=$friendlymonth" "$startyear
if [ $startmonth = 12 ];then
endyear=$(($startyear+1))
endmonth=1
else
endyear=$startyear
endmonth=$(($startmonth+1))
fi
startdate=1/$startmonth/$startyear
enddate=1/$endmonth/$endyear
Idea being to put the start & end dates into variables “startdate” and “enddate” to restrict the report range.
If I run:
rt list "queue = 'myqueue' and created > '$startdate'"
It returns results correctly.
If I run:
rt list “queue = ‘myqueue’ and created < ‘$enddate’”
It says “No matches found”.
If I manually enter:
rt list "queue = 'myqueue' and created < '1/2/2011'"
Then it works correctly.
root@sirius:/ # echo $startdate $enddate
1/01/2011 1/2/2011
They’re obviously different - “startdate” has a month of “01” whilst “enddate” is “2”. But startdate works, and enddate not…
Is there some way I need to format the resulting variable differently so that it knows it’s a date and is treated as such?
Thanks,
Chris Herrmann
Far Edge Technology
p. 02 84251400
m. 0403 393309