Fixes for mersdk

MerSDK has older bash and grep, which do not understand newer syntaxes. This fixes the issues.