I'm looking to put my system uptime into my bash prompt. I checked out the Bash-Prompt-HOWTO and it showed a script the author had written. I tried to make this into a script that I could use, but bash is returning errors. I don;t know the first thing about bash programming, so could someone help find the error? Thanks!
icy
Code:
#!/bin/bash
#
# upt - show just the system uptime, days, hours, and minutes
let upSeconds="$(cat /proc/uptime) && echo ${temp%%.*})"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
if [ "${days}" -ne "0" ]
then
echo -n "${days}d"
fi
echo -n "${hours}h${mins}m"