title: BASH : control exits CASE logic after entering any condition - Unable to understand the reason
body: <p>I have an input file, which has below data :</p>
  <pre><code>driver2:y
  driver5:y
  driver3:n
  driver1:y
  driver4:y
  </code></pre>
  <p>The requirement is, for each driver if the value is &quot;y&quot; then the script has to check for the existence of a set of files that are related to that driver. If all of them exist, then only that driver related next step should be performed.</p>
  <p>The main script reads line by line from the input.txt file. and I'm using CASE for this.</p>
  <p>My problem is when I try to call the function_exists() from the CASE logic (which are commented in the script as you can see) or If I use any &quot;IF&quot; conditions instead of function_exists() to perform the same check, that particular part in the CASE logic is executing (say driver2, all the code under &quot;driver2)&quot; executes) and the script control is automatically exiting the CASE logic and script is ending, without reading the remaining lines from the input file.</p>
  <p>The script is reading all entries, but something is wrong with the CASE logic when I'm using functions and IF conditions.</p>
  <p>I'm unable to understand what went wrong with the script, what mistake I'm doing here. Can someone help me with this?</p>
  <pre><code>#!/bin/sh
  
  function_exists ()
  {
  ssh $remote_server &quot;test -e $1&quot;
  if [ $? == 0 ]
          then
          echo &quot;file found : $1&quot;
          else
          echo &quot;file not found : $1&quot;
  
  fi
  echo &quot;***** exiting function&quot;
  }
  
  remote_server=&quot;vmlinux1&quot;
  input=&quot;input.txt&quot;
  
  while IFS= read -r line
  do
          IFS=&quot;:&quot;
          read -ra arr &lt;&lt;&lt; &quot;$line&quot;
          driver=${arr[0]}
          export driver=$driver
          driverInstall=${arr[1]}
          echo &quot;read value&quot; $driver $driverInstall
  
          if [ $driverInstall == 'y' ]; then
                  case $driver in
  
                  driver1)
                  echo &quot;entered driver 1&quot;
                  #function_exists /opt/installer/file1.txt
                  echo &quot;***** control came back to $driver&quot;
                  ;;
  
                  driver2)
                  echo &quot;entered driver 2&quot;
                  #function_exists /opt/installer/file2.txt
                  echo &quot;***** control came back to $driver&quot;
                  continue
                  ;;
  
                  driver4)
                  echo &quot;entered driver 4 - for directory check&quot;
                  #function_exists /opt/installer/directory1
                  echo &quot;***** control came back to $driver&quot;
                  ;;
  
                  *)
                  echo &quot;${driver} - NOTHING DEFINED&quot;
                  ;;
  
                  esac
          else
          echo &quot;${driver} - SKIPPED &quot;
          fi
  
  done &lt; &quot;$input&quot;
  
  echo &quot;Script ended 
  ========================================&quot;
  </code></pre>