title: How does this Bash script work?
body: <pre><code>read -r -p "Are you sure? [y/N] " response
   if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
  then
   do_something
  else
   do_something_else
  fi
  </code></pre>
  
  <p>I saw this script on a stack overflow website I used the following script because I couldn't write one myself because it threw errors. I know this script will wait for user input such as y/n but I would like detailed explanation about how this script works like what does <code>=~</code> do and what does <code>^([yY][eE][sS]|[yY])+$ ]]</code> do.</p>