Re: [PATCH] t4014: shell portability fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]