1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
shopt -s globstar wdir=$PWD : ${TMPDIR:=/var/tmp} DIR=$TMPDIR/globstar-$$ mkdir -p $DIR cd $DIR || { echo "$DIR: cannot cd" >&2 exit 1 } mkdir -p foo/{a,b} bar/{c,d,foo/{e,f}} baz/{g,h} echo **/foo* echo **/foo*/ echo **/foo*/* cd $wdir rm -rf $DIR