#!/bin/bash set -e tmp=`dpkg -l | grep syslog | awk '{print $2}'` output_lines=`echo "$tmp" | wc -l` if [[ -z $tmp ]]; then echo ERROR THERE IS NO SYSLOG PACKAGE INSTALLED echo "$tmp" exit 1 elif (( output_lines > 1 )); then echo ERROR THERE IS MORE THAN ONE SYSLOG PACKAGE INSTALLED echo "$tmp" exit 1 else # we do print a carriage return at the end # this makes it compatible with both clusterit and ansible conditions against stdout|trim echo $tmp fi