shell script improvements [skip ci]