make publish.sh failsafe when invoked using sh