From: Junio C Hamano Date: Wed, 01 Jun 2016 06:49:10 GMT Subject: Re: [PATCH] t4014: shell portability fix Message-ID: In-Reply-To: <20160601054048.GB20797@sigill.intra.peff.net> Jeff King writes: > 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#*=}" Is this an elaborate way to say 'eval "$1"', or is there anything more subtle going on? > eval "export ${1%%=*}" > shift > ;; > *) > "$@" > exit ... or 'exec "$@"' > ;; > esac > done > ) > } You can dedent the whole thing and remove the outermost {} pair. Other than that, looks good to me. > > -Peff