Python 获取shell脚本执行的返回结果
http://songpengfei.iteye.com/blog/1701617
http://blog.csdn.net/duan19056/article/details/41277869
1.Python 获取shell脚本执行的返回结果
import subprocess
p = subprocess.Popen('./test.sh',stdout=subprocess.PIPE)
output=p.stdout.readlines()
print output
2.如何获取shell函数的返回值及shell命令的返回值?
#!/bin/sh
info()
{
cat jlb.sh
}
res=`info`
echo "state: "$?
echo "res: "${res}
show partiones $tableName;