On 2/26/12 6:06 AM, Dan Douglas wrote: > I just tested a bunch of permutations. I was a bit surprised to see this one > fail:
You shouldn't have been. The entire function definition, including the additional embedded function definition, is parsed before any of it is executed. > > f() > if [[ $FUNCNAME != ${FUNCNAME[1]} ]]; then > trap 'shopt -u extglob' RETURN > shopt -s extglob > f > else > f()( > shopt -s extglob > echo !(x) > ) > f > fi > > f -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/