ormaaj 1349236139 learn sh# f() { _f() { x="in f"; echo "$x"; }; x= command eval _f '"$@"'; unset -f _f; }; x="outside f"; echo "$x"; f; echo "$x" ormaaj 1349236625 forget ormaaj 1349236634 learn sh# f() { _f() { x="in f"; printf "${x}, "; }; x= command eval _f '"$@"'; unset -f _f; }; x="outside f"; printf "${x}, "; f; echo "$x" ormaaj 1349276457 forget ormaaj 1349276475 learn sh# f() { if [ -n "${_called_f+_}" ]; then for x; do printf '%s, ' "$x"; done; else _called_f= x= command eval '{ typeset +x x; } 2>/dev/null; f "$@"'; fi; }; x='outside f'; printf "$x, "; f 1 2 3; echo "$x" ormaaj 1358396309 forget ormaaj 1358396424 learn sh# f() { if ! ${_called_f+false}; then for x; do printf '%s, ' "$x"; done; else _called_f= x= command eval '{ typeset +x x; } 2>/dev/null; f "$@"'; fi; }; x='outside f'; printf "$x, "; f 1 2 3; echo "$x"