Refactoring backup script to use best practice for bash scripts