rewrite script using os.system