<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:10.0pt'>Hi all,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>Another problem to do with (I suspect) dates not be treated as dates.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>My script has this block at the front to set some variables, so that I can eventually run it from a regular cron job:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>startmonth=`date +%m`<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>startyear=`date +%Y`<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>endyear=$startyear<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>friendlymonth=`date +%b`<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>reportperiod=$friendlymonth" "$startyear<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>if [ $startmonth = 12 ];then<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'> endyear=$(($startyear+1))<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'> endmonth=1<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>else<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'> endyear=$startyear<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'> endmonth=$(($startmonth+1))<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>fi<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>startdate=1/$startmonth/$startyear<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:10.0pt'>enddate=1/$endmonth/$endyear<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>Idea being to put the start & end dates into variables “startdate” and “enddate” to restrict the report range.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>If I run:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'> rt list “queue = ‘myqueue’ and created > ‘$startdate’”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>It returns results correctly.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>If I run:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'> rt list “queue = ‘myqueue’ and created < ‘$enddate’”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>It says “No matches found”.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>If I manually enter:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'> rt list “queue = ‘myqueue’ and created < ‘1/2/2011’”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>Then it works correctly.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>root@sirius:/ # echo $startdate $enddate<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>1/01/2011 1/2/2011<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>They’re obviously different – “startdate” has a month of “01” whilst “enddate” is “2”. But startdate works, and enddate not...<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>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?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;color:black;mso-fareast-language:EN-AU'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;color:black;mso-fareast-language:EN-AU'>Chris Herrmann<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;color:black;mso-fareast-language:EN-AU'>Far Edge Technology<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;color:black;mso-fareast-language:EN-AU'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;color:black;mso-fareast-language:EN-AU'>p. 02 84251400<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;color:black;mso-fareast-language:EN-AU'>m. 0403 393309<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;color:black;mso-fareast-language:EN-AU'><a href="http://www.faredge.com.au"><span style='color:blue'>http://www.faredge.com.au</span></a> <o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>