improve portability; make script work using bash