From: Chris Koeritz Date: Sat, 11 Apr 2015 03:22:05 +0000 (-0400) Subject: fixed for platforms that don't support the nice human readable -p flag on uptime. X-Git-Tag: 2.140.90~663 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=9634ea4fd5dac7019b66f0128767bcd687667061;p=feisty_meow.git fixed for platforms that don't support the nice human readable -p flag on uptime. --- diff --git a/scripts/core/inventory.sh b/scripts/core/inventory.sh index 8e7f4d75..55212f9c 100644 --- a/scripts/core/inventory.sh +++ b/scripts/core/inventory.sh @@ -16,8 +16,16 @@ if [ -z "$codename" ]; then codename="mysterioso" fi +# test if this uptime knows the -p flag. +uptime -p &>/dev/null +if [ $? -eq 0 ]; then + up="$(uptime -p)" +else + up="up $(uptime)" +fi + echo -echo "it is $(date +"%A at %H%M hours on day %e of the %B moon in the gregorian year %Y" | tr A-Z a-z) and our intrepid adventurer $USER is exploring a computer named $(hostname) (code-name $codename) and has found that the machine's OS platform is $(uname -m) and its current incarnation has been $(uptime -p)." | splitter +echo "it is $(date +"%A at %H%M hours on day %e of the %B moon in the gregorian year %Y" | tr A-Z a-z) and our intrepid adventurer $USER is exploring a computer named $(hostname) (code-name $codename) and has found that the machine's OS platform is $(uname -m) and its current incarnation has been ${up}." | splitter #hmmm: splitter not accepting these args properly right now: #--mincol 2 --maxcol 40 echo