Skip to content

Instantly share code, notes, and snippets.

@jeremy4971
Last active January 6, 2024 10:31
Show Gist options
  • Save jeremy4971/4a1ffcee281aee1921362822cf8e086c to your computer and use it in GitHub Desktop.
Save jeremy4971/4a1ffcee281aee1921362822cf8e086c to your computer and use it in GitHub Desktop.
#!/bin/sh
###
#
# Original author : Steve Wood
# Created : 2010-01-19
# Last Modified : 2022-09-11
# Version : 1.0
#
###
days=$(uptime | awk '{ print $4 }' | sed 's/,//g')
num=$(uptime | awk '{ print $3 }')
if [ "$days" = "days" ]; then
echo "<result>$num</result>"
elif [ "$days" = "day" ]; then
echo "<result>1</result>"
else
echo "<result>0</result>"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment