added working birthday function for OS X

This commit is contained in:
Andrew Titmuss 2016-03-12 10:17:26 +11:00
parent 3ed4c43636
commit 641470ccd7

View file

@ -1564,8 +1564,23 @@ getbirthday () {
;;
"Mac OS X")
birthday="$(ls -alctT /var/log/CDIS.custom | awk '{printf $6 " " $7 " " $9 " " $8}')"
date_cmd="$(date -j -f "%b %d %Y" "$birthday" +"$birthday_format")"
birthday="$(ls -lUT /var/log/install.log | awk '{printf $6 " " $7 " " $9 " " $8}')"
# Split the string into Date + time
time=${birthday/*???? }
birthday=${birthday/$time}
case "${time/:*}" in
0? | 10 | 11)
time+=" AM"
;;
*)
time+=" PM"
;;
esac
birthday+="$time"
birthday_shorthand="on"
;;
*"BSD")
@ -1603,7 +1618,7 @@ getbirthday () {
esac
# Strip seconds from time output
birthday=${birthday%:*}
birthday=${birthday/:?? /}
# Pretty output
[ "$birthday_shorthand" == "off" ] && \