I have a glob pattern {,**/}*.* for recursing through all files in current directory plus children. In the terminal if I run echo {,**/}*.* 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.
I understand that terminal has different behaviour than the shell: adding shopt -s extglob made no difference.
#!/bin/bash
shopt -s extglob
echo {,**/}*.*
I am on MacOSX with Bash 4 terminal and shopt -s globstar enabled.
Thanks @Aserre and @anubhava, it was indeed the combination of bash path and making sure globstar was enabled (for MacOSX). Full script is:
#!/usr/local/bin/bash
shopt -s globstar
echo {,**/}*.*
And yes ./** would suffice but that wasn't my problem :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With