Web lists-archives.com

Re: [PATCH] test-lib: check Bash version for '-x' without using shell arrays




Johannes Sixt <j6t@xxxxxxxx> writes:

> 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.