[root@node29 ~]# vim ./test.sh # Python脚本内容 PYTHON_TXT="\ #! /usr/bin/env python #coding: utf-8 import sys import os if __name__ == '__main__': file = sys.argv[1] with open(file, 'r') as r_f: for line in r_f: print(line) " # 生成Python脚本文件 echo "${PYTHON_TXT}" > ./test.py # 执行Python脚本 python ./test.py big_file.txt