[ale] bash question

Christopher Bergeron christopher at bergeron.com
Mon Jul 7 13:42:13 EDT 2003


I'm trying to compare the output of a command in an if conditional using 
bash.  The only problem is that I can't figure out how it's done, and 
everything that I try to search for on google brings up a million 
unrelated hits.  I looked through advanced bash scripting guide, but 
still couldn't find the answer.  Hopefully, someone on the list can help 
me with this one:

I have a file that contains a date in the format:
20030705

and I'd like to perform an if conditional like such:

if [ `date +%Y%m%d` -eq `cat datefile.txt` ]; then
echo They match!
else
echo They dont match!
fi

but that doesn't seem to work.  Can anyone give me any pointers on how I 
can accomplish this?

Much thanks,
CB



_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list