This is the mistake:
if [ "$DAY" > 15 ];thenFix:
if [ "$DAY" -gt 15 ];then--
A suggestion for efficient handling of "date to variables":
eval $(date "+DAY=%d MONTH=%b YEAR=%Y")fills three shell...
You haven't said what shell you are using. If this is ksh or plain sh, then the test you are performing in your if statement is still not valid. The double [ and ] suggested are bash. You are...
The -d option of date takes one single date only, not several separated by a line feed char. How about
D="$(stat -c %z sh* | awk -F"[ -]" '{print $3}')"
echo "$D"
03
03