#!/bin/bash
function yes_no {
  MSG=$1
  while :
  do
    echo -n "${MSG} y/N: "
    read ans
    case $ans in
    [yY]) return 0 ;;
    [nN]) return 1 ;;
    esac
  done
}

yes_no 'Do you like LINUX ?'
echo return:$?
yes_no 'Do you like Windows ?'
echo return $?
