Training/githooks/pre-commit

8 lines
402 B
Bash

#!/bin/sh
offlineDate="$(date +"%j")"
onlineDate=$(echo cat $(echo cat $(curl -L 'timeanddate.com/calendar/custom.html?country=20&cols=6&hol=0&pbr=1&ctf=5&ctc=2&cci=6&ccu=5&holm=1&doy=1&display=2&df=1' 2> /dev/null) | grep -o -E "chi\"> <span class=cyd>\([0-9]{1,3}\)</") | grep -o -E "[0-9]{1,3}")
if [ $onlineDate -ne $offlineDate ]; then
echo "Date is incorrect! Check your local date!"
exit 1
fi