I'm trying to compare two dates. The system date vs a file date. I'm having trouble and the error I am getting is this:
./hello.sh: line 25: [10-18-2018: command not found
I have also tried with =,==,-eq.
#Setting variable
now=$(date +"%m-%d-%Y")
#Testing variable
echo "Current System Date: $now"
#Setting variable
filedate=$(date -r hello.sh "+%m-%d-%Y")
#Testing variable
echo "hello.sh date: $filedate"
if [$now -ge $filedate]
then
echo This statement works
else
echo This statement didnt work
fi