grep -i $hostgrep ids_ssh_white_list test=$? if [ $test -ne 0 -a $ntry -ge $nmax ] then (doing something) fi