yes_or_no_select() {
  printf '%b\n' "\e[1;33m$* [yes/no]\e[m"
  read -r ans
  case ${ans} in
    yes | y)
      return 0
      ;;
    no | n)
      return 1
      ;;
    *)
      yes_or_no_select
      ;;
  esac
}

if yes_or_no_select "Are you ready for starting install?"; then
  echo foo
else
  >&2 printf '%s\n' 'Exiting.'
  exit 1
fi
