Fix test so that it is /bin/sh compliant (issue #2742)

The old test used syntax that appeared to be bash-specific and did not
work on platforms where /bin/sh did not point to bash.  See issue #2742
where copy to solaris hosts failed with the error:

    output: {'stdout': '', 'stderr': '/bin/sh: test: argument expected\n',
             'rc': 1}
Merge pull request #2745 from sfromm/issue2742

Fix test so that it is /bin/sh compliant (issue #2742)