Last active
August 11, 2021 09:18
-
-
Save petervandivier/e4a314d3f7a4b20dbba332142afdc0b1 to your computer and use it in GitHub Desktop.
gdate_best_date.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# usage: dot-source to export to the current shell context | |
# . ./gdate_best_date.sh | |
# | |
# remove the override with `unset -f`: | |
# unset -f date | |
# | |
if ! ( date --version 2>&1 | grep GNU > /dev/null ); then | |
function date() { | |
gdate "$@" | |
} | |
if ! ( date --version 2>&1 | grep GNU > /dev/null ); then | |
echo "GNU Coreutils \`date\` (\`gdate\`) was not found and is required. Exiting." 1>&2 | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HT