#!/bin/bash

# created by masterminds

a=`cat /proc/uptime | cut -d " " -f1`
b=`echo $a | cut -d "." -f1`
e=`expr $b \/ 86400`
f=`expr $b \% 86400`
g=`expr $f \/ 3600`
h=`expr $f \% 3600`
i=`expr $h \/ 60`
j=`expr $h \% 60`

if [ $e == 0 ]
then
if [ $g == 0 ]
then
echo "Uptime: $i min, $j sec"
else
echo "Uptime: $g hour, $i min, $j sec"
fi
else
if [ $g == 0 ]
then
echo "Uptime: $e day, $i min, $j sec"
else
echo "Uptime: $e day, $g hour, $i min, $j sec"
fi
fi