Hi
I am trying to write a simple IF statement in VI that would look at the systems date and compare it to a date that someone has entered in to the terminal and depending if the date matches it would display a message on the screen. I have gotten it to prompt for the date on the terminal but it doesn't matter what date I put in it just give the ELSE prompt. I am not sure what I am doing wrong.
Code:
echo "Enter Date"
read option
if [ "$option" = date +"%m-%d-%Y"]; then
echo "Homework is due."
else
echo "Do your homework!"
fi
Here is a sample of the output. I pulled the date to see what it looks like so I can make sure the format is the same.
Code:
[Icewolf@Crazy ~]$ date +"%m-%d-%Y"
08-13-2011
[Icewolf@Crazy ~]$ ./lab5if
Enter Date08-13-2011
./lab5if: line 5: [: missing `]'
Do your homework!
Thanks
Andy