refactor bash