쉘 스크립트를 작성하기 위해서는 셸 문법을 숙지하고 있어야 한다. 셸 문법이 어렵다면 파이썬으로 작성된 프로그램에서 쉘 명령어를 사용할 수도 있다.
1. 쉘 명령어 실행
import os
os.system('shell command')
2. 출력 결과 저장
import os
result = os.popen('shell command').read()
[출처] http://brownbears.tistory.com/197
'Programming' 카테고리의 다른 글
[python] .pyc 파일은 무엇일까? (0) | 2017.09.26 |
---|---|
[python] os 와 sys 모듈 (0) | 2017.08.07 |
[linux] bash (쉘) 명령어 문법 Bash command syntax (0) | 2017.08.04 |
[linux] bash에서 계산하기, bash calculation (0) | 2017.08.04 |
[linux] 간단한 vim조작법 (0) | 2017.08.04 |