Do this by adding an OS type check and also adding the relevant date commands for Linux. Also check for OS type FreeBSD, since the script should work on there, if it works on Darwin.