Bash scripts refactoring.