#!/bin/bash vmstat 5 1|tail -1|awk '{print $7,$8}' | while read vmstatResults; do SI=$(echo $vmstatResults | awk '{Print $1}') SO=$(echo $vmstatResults | awk '{Print $1}') if [[ $SI -gt 0 || $SO -gt 0 ]] then echo "swapping is showing as greater than zero in vmstat" return 1 else echo "vmstat is showing no swapping" return 0 fi done