title: How to get the exit status a loop in bash
body: <p>I know how to check the status of the previously executed command using $?, and we can make that status using exit command. But for the loops in bash are always returning a status 0 and is there any way I can break the loop with some status. </p>
  
  <pre><code>#!/bin/bash
  while true
  do
          if [ -f "/test" ] ; then
                  break ### Here I would like to exit with some status
          fi
  
  done
  echo $?  ## Here I want to check the status.
  </code></pre>