Better comma hanfling

This commit is contained in:
Dylan 2016-04-29 10:19:09 +10:00
parent ecdc3ff9b4
commit 08e8113c8b

View file

@ -597,17 +597,25 @@ getuptime () {
esac
case "$hours" in
1) hours="1 hour," ;;
1) hours="1 hour" ;;
0) unset hours ;;
*) hours="$hours hours," ;;
*) hours="$hours hours" ;;
esac
case "$days" in
1) days="1 day," ;;
1) days="1 day" ;;
0) unset days ;;
*) days="$days days," ;;
*) days="$days days" ;;
esac
[ ! -z "$hours" ] && \
[ ! -z "$minutes" ] && \
hours+=","
[ ! -z "$days" ] && \
[ ! -z "$hours" ] && \
days+=","
uptime="up $days $hours $minutes"
;;
esac