Re: [PATCH] test-lib: check Bash version for '-x' without using shell arrays
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 2, 2019, 16:46 UTC
- Message-ID
- <xmqqa7kjknwp.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <a82251fa-38e1-233e-50d3-3ed4850b4e11@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 9 quoted lines
> Would it perhaps be simpler to just hide the syntax behind eval? Like
>
> if test -z "$test_untraceable" || {
> test -n "$BASH_VERSION" && eval '
> test ${BASH_VERSINFO[0]} -gt 4 || {
> test ${BASH_VERSINFO[0]} -eq 4 &&
> test ${BASH_VERSINFO[1]} -ge 1
> }
> 'It indeed is somewhat easier to see that your version does exactly the same as the original than the posted patch, but the pattern substitutions are not all that bad, either.