grep - global regular expression parser.

Searches input for a match to a pattern defined by a regular expression.

Processes 1 line at a time.

Expects text based data, lines terminated in new-line character

Input most commonly a file or list of files but can also be provided using the pipe delimiter or input redirection.

Output is to standard out, so output redirection commonly used to preserve found match.

Output consists of whole lines containing the matched string.


Some Options :
Define a function called ask with the following code :

local ask

read -p "Continue : " ask

if echo $ask | grep -e "^[Yy]\(es\)\?$" >  /dev/null 2>&1
then
  echo "It's a yes"

elif echo $ask | grep -e "^[Nn]o\?$" >  /dev/null 2>&1
then
  echo "It's a no"

else
   echo "Make up your mind"

fi
Then try the following :