Re: [PATCH] t4014: shell portability fix
- From
Jeff King <peff@peff.net>
- Date
- Jun 1, 2016, 05:40 UTC
- Message-ID
- <20160601054048.GB20797@sigill.intra.peff.net>
- In-Reply-To
- <20160601053325.GA20797@sigill.intra.peff.net>
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