def METHOD_NAME(self, repair_dir_path, script, catalog_name=None):
    bash_file_path = self._get_bash_filepath(repair_dir_path, catalog_name)
    if not os.path.isfile(bash_file_path):
        script = '#!/bin/bash\nset -o errexit\ncd $(dirname $0)\n' + script
    with open(bash_file_path, 'a') as bash_file:
        bash_file.write(script)
    os.chmod(bash_file_path, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR)