From 1149b3d6a6dca6f6e2c797e0de422919d82c18c7 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 30 Jan 2016 23:34:53 +1100 Subject: [PATCH] Fix birthday output on OS X --- fetch | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fetch b/fetch index 56e8b39f..959c3ce8 100755 --- a/fetch +++ b/fetch @@ -57,7 +57,7 @@ printinfo () { # info "Disk" disk # info "Resolution" resolution # info "Song" song - # info "Birthday" birthday + info "Birthday" birthday # info "Visual Style" visualstyle info linebreak @@ -1190,12 +1190,14 @@ getdisk () { getbirthday () { case "$os" in - "Linux" | *"BSD") + "Linux") birthday="$(ls -alct --full-time / | awk '/lost\+found/ {printf $6 " " $7}')" + date_cmd="$(date -d"$birthday" "+%a %d %b %Y %l:%M %p")" ;; - "Mac OS X") + "Mac OS X" | *"BSD") birthday="$(ls -alctT /var/log/CDIS.custom | tail -1 | awk '{printf $6 " " $7 " " $9 " " $8}')" + date_cmd="$(date -j -f "%b %d %Y" "$birthday" "+%a %d %b %Y %l:%M %p")" ;; *) @@ -1209,8 +1211,8 @@ getbirthday () { # Pretty output if [ "$birthday_shorthand" == "off" ]; then - birthday="$(date -d"$birthday" "+%a %d %b %Y %l:%M %p")" - birthday=${birthday/ } + birthday="$date_cmd" + birthday=${birthday/ / } fi # Toggle showing the time