I usually develop and test my BASH scripts on my mac, mostly for use on RedHat systems. Occasionally I run into problems with this workflow. Recently I realized there was a differnce between the date command on RedHat and the date command in OS X. Turns out BDS date != GNU date. The workaround, install coreutils from Mac Ports, and add this alias to my .bashrc:
alias date=”/opt/local/bin/gdate”
Update: gdate is part of the GNU coreutils, and the MacPorts install command for gdate is: sudo port install coreutils
Thank you, this was very helpful!