optimizing shell publish script