14-3
fn = raw_input('$py:')
execfile(fn)
14-4
import os
from subprocess import call
os.system('dir')
call('dir', shell=True)
14-5
from commands import getoutput
output = getoutput('ls')
14-6
from subprocess import Popen, PIPE
fn = Popen('dir', stdout=PIPE, shell=True)
for eachline in fn.stdout:
print eachline
14-8
import sys
def foo():
print 'exit .. . '
sys.exitfunc = foo
print '123'
14-9
import os
while True:
cmd = raw_input("$:")
if cmd == 'exit':
break
f = os.popen(cmd)
for line in f:
print line,