r="$(grep -o -e 'OOO' -e 'XXX' | head -n 1)" [ "$r" = "OOO" ] && echo East && exit 0 [ "$r" = "XXX" ] && echo West && exit 0 echo NA