title: Bash glob pattern behaviour different between terminal and shell script
body: <p>I have a glob pattern <code>{,**/}*.*</code> for recursing through all files in current directory plus children. In the terminal if I run <code>echo {,**/}*.*</code> it outputs all of the files in the current directory plus the nested directories. When I run a shell script which contains this line it only does one directory deep.</p>
  
  <p>I understand that <a href="https://superuser.com/a/715018/665794">terminal has different behaviour than the shell</a>: adding <code>shopt -s extglob</code> made no difference.</p>
  
  <pre><code>#!/bin/bash
  
  shopt -s extglob
  echo {,**/}*.*
  </code></pre>
  
  <p>I am on MacOSX with <a href="https://gist.github.com/reggi/475793ea1846affbcfe8" rel="nofollow noreferrer">Bash 4 terminal</a> and <code>shopt -s globstar</code> enabled.</p>