Add special handling for mac os x (mojave/darwin18)

- date does not have option `--rfc-3339`
- `rand` is not available, use `jot` instead
This commit is contained in:
Thomas Lauf 2019-03-02 17:01:55 +01:00
parent f05596fa1d
commit a6d97365fc

View file

@ -2,12 +2,26 @@
function current_date() function current_date()
{ {
case "${OSTYPE}" in
darwin*)
date "+%Y-%m-%d"
;;
*)
date --rfc-3339=date date --rfc-3339=date
;;
esac
} }
function random_minute() function random_minute()
{ {
case "${OSTYPE}" in
darwin*)
echo "0$( jot 1 0 59 )" | sed "s|.\+\(..\)\$|\1|g"
;;
*)
echo "0$( rand -M 60 )" | sed "s|.\+\(..\)\$|\1|g" echo "0$( rand -M 60 )" | sed "s|.\+\(..\)\$|\1|g"
;;
esac
} }
function default_hours() function default_hours()