Hello,
My script is like :
#!/bin/sh -x
TODAY=$(echo `date +"%b%d"`)
FILE_DATE=$(ls -l test.sh | awk '{print $6$7}')
echo "file date=$FILE_DATE"
echo "date=$TODAY"
if ["$TODAY" == "$FILE_DATE"]];then
echo "file is correct"
else
echo "file is incorrect"
fi
and The Output is :
$ ./test.sh
+ + date +%b%d
+ echo Jan21
TODAY=Jan21
+ + ls -l test.sh
+ awk {print $6$7}
FILE_DATE=Jan21
+ echo file date=Jan21
file date=Jan21
+ echo date=Jan21
date=Jan21
+ [Jan21 == Jan21]]
./test.sh[6]: [Jan21: not found
+ echo file is incorrect
file is incorrect
Please let me know where i am doing wrong.
Regards,
saurau