쉘 스크립트를 작성하기 위해서는 셸 문법을 숙지하고 있어야 한다. 셸 문법이 어렵다면 파이썬으로 작성된 프로그램에서 쉘 명령어를 사용할 수도 있다.


1. 쉘 명령어 실행

import os

os.system('shell command')


2. 출력 결과 저장

import os

result = os.popen('shell command').read()


[출처] http://brownbears.tistory.com/197

+ Recent posts