#!/bin/bash # load -- prints the machine load # returns 0 if the load is below the warning load, 1 if above # the minimum warning load can be supplied as an argument (eg, load 2) TARGET=${1:-1} # minimum warning load (must be an integer) UPTIME=$(uptime | sed 's/.*averages: \([^ ]*\).*/\1/') echo $UPTIME UPTIME=$(echo $UPTIME | sed 's/\..*//') #integer test $TARGET -gt $UPTIME #for exit value