cat /etc/group | grep GROUP_NAME 1> /dev/null echo $? #result 0 or 1 #or if ! cat /etc/group | grep $1 1> /dev/null then echo "Error! $1 doesn't exist!" else echo "$1 group exist!" fi