I am trying to print a date between two dates using a while loop in a bash script.
But when I execute, I get below the error:
test.sh: line 8: [: 02-12-14: integer expression expected
Below is my code, can anyone help me.
#!/bin/bash
sdate=02-12-14
edate=02-25-14
while [ "$sdate" -le "$edate" ]
do
echo $sdate
sdate=$(date +%m-%d-%y -d "$sdate + 1 day")
done
source
share