title: nested while loops (bash scripting in linux)
body: <p>I'm having trouble with my nested while loops. My problem is that my inner while loop only executes once but my outer loop is able to continue to repeat. Here's my code: </p>
  
  <pre><code>while [[ "$input" != "exit" &amp;&amp; "$input" != "Exit" &amp;&amp; "$input" != "EXIT" ]]
  do
  
    echo 'Enter "name" to find files by name'
  
    read input
  
  
    if [[ "$input" = "name" || "$input" = "Name" || "$input" = "NAME" ]]; then
  
  
       while [[ "$a" != "f" &amp;&amp; "$a" != "s" ]]
       do
          read -p "Want to search inside only the current folder (f) or include subfolders (s)" a
          if [ "$a" = "f" ]; then
             echo 'f'
  
          elif [ "$a" = "s" ]; then
             echo 's' 
  
          elif [[ "$a" != "f" &amp;&amp; "$a" != "s" ]]; then
             echo 'you have entered an invalid option, please try again'
  
          fi
       done
    fi
  done
  </code></pre>
  
  <p>Here's a sample output:</p>
  
  <p>Enter "name" to find files by name</p>
  
  <p>Enter "size" to find files with a specified size</p>
  
  <p>Enter "date" to find files by date</p>
  
  <p>Enter "string" to find files containing a particular string</p>
  
  <p>Enter "exit" to exit the script.</p>
  
  <p>name</p>
  
  <p>Want to search inside only the current folder (f) or include subfolders (s)t</p>
  
  <p>you have entered an invalid option, please try again</p>
  
  <p>Want to search inside only the current folder (f) or include subfolders (s)s</p>
  
  <p>s</p>
  
  <p>Enter "name" to find files by name</p>
  
  <p>Enter "size" to find files with a specified size</p>
  
  <p>Enter "date" to find files by date</p>
  
  <p>Enter "string" to find files containing a particular string</p>
  
  <p>Enter "exit" to exit the script.</p>
  
  <p>name # right here is where my inner loop failed to run but I don't see why</p>
  
  <p>Enter "name" to find files by name</p>
  
  <p>Enter "size" to find files with a specified size</p>
  
  <p>Enter "date" to find files by date</p>
  
  <p>Enter "string" to find files containing a particular string</p>
  
  <p>Enter "exit" to exit the script.</p>