Re: [PATCH] t4014: shell portability fix

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

 



Jeff King <peff@xxxxxxxx> 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
--
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]