write more robust shell scripts