From 9634ea4fd5dac7019b66f0128767bcd687667061 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Fri, 10 Apr 2015 23:22:05 -0400 Subject: [PATCH] fixed for platforms that don't support the nice human readable -p flag on uptime. --- scripts/core/inventory.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- 2.34.1