True, works without -n too. Also I'm using this script to show uptime in decimal numbers: Code: #!/usr/bin/python # Show Device Uptime in decimal days sc = u"\u2622" seconds = int(float(open('/proc/uptime').read().split()[0])) print 'up: '+("%.1f" % (float(seconds)/float(60*60*24))).replace('.', ',')+' d'+' '+sc.encode('utf-8') Now I want it to show the after decimal point only when upime is <10 days. So that it would print "9,9 days" and "10 days". Could someone put that rule to the script please?
#!/usr/bin/python # Show Device Uptime in decimal days sc = u"\u2622" seconds = int(float(open('/proc/uptime').read().split()[0])) print 'up: '+("%.1f" % (float(seconds)/float(60*60*24))).replace('.', ',')+' d'+' '+sc.encode('utf-8')
#!/bin/sh #uptime days=$(cat /proc/uptime | awk '{print $1}') days2=`dc $days 86400 / p | cut -c1-4` days3=`dc $days 86400 / p | awk -F"." '{print $1}'` if [ $days3 -lt 10 ] then echo -n -e up\: $days2 else echo -n -e up\: $days3 fi echo -n -e \ "\xe2\x98\xA2"