#! /bin/bash while true ; do read if [ -z "$REPLY" ] ; then echo one elif [ "$REPLY" == "a" ] ; then echo two else exit fi done