bash style cleanup

* no functional changes, just refactoring / cleanup
* note that I have kept in place the sh style tests even though bash specific feature (array) is being used; I actually converted one bash style test to sh style to unify the style

note:
I don't like the hash line at the start, probably the 'env' style is what is recommended to use these days for portability reasons, but I am not sure that it is supported on all RHELs that we want to support so I am leaving that for now