Guest_imported
New member
- Jan 1, 1970
- 0
I have a script which interrogates & retrieves records from a file. The 1st field in the file is a date with format CCYY-MM-DD. At the moment, my script accepts a run-time date variable ( same format as above ) and compares this value with the dates on the file, & retrives matches.
if [[ $filedate = $variabledate ]]
then
etc etc
This works fine.
I now want to add a second date variable, and amend the test to select records within a range. But what is the syntax ?
I have tried
if [[ $filedate > $variabledate1 && $filedate < $variabledate2 ]]
but this returns records with filedate = variabledate1, and duplicates some of the retrieved fields !
if [[ $filedate > $variabledate1 ]] && [[ $filedate < $variabledate2 ]] gives a syntax error.
Please help
if [[ $filedate = $variabledate ]]
then
etc etc
This works fine.
I now want to add a second date variable, and amend the test to select records within a range. But what is the syntax ?
I have tried
if [[ $filedate > $variabledate1 && $filedate < $variabledate2 ]]
but this returns records with filedate = variabledate1, and duplicates some of the retrieved fields !
if [[ $filedate > $variabledate1 ]] && [[ $filedate < $variabledate2 ]] gives a syntax error.
Please help