On Wed, Jun 01, 2016 at 01:33:25AM -0400, Jeff King wrote:

> Here is the "final" version of the more complicated scheme I came up
> with. That I think should be fairly portable, but the subshell thing is
> probably way less gross.

OK, last email tonight, I promise.

Here's the subshell version. I'm a little embarrassed not to have
thought of it sooner (though the other one was a fun exercise).

        test_env () {
                (
                        while test $# -gt 0
                        do
                                case "$1" in
                                *=*)
                                        eval "${1%%=*}=\${1#*=}"
                                        eval "export ${1%%=*}"
                                        shift
                                        ;;
                                *)
                                        "$@"
                                        exit
                                        ;;
                                esac
                        done
                )
        }

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to