【发布时间】:2012-03-05 23:30:10
【问题描述】:
我发誓我以前看过这个,但现在找不到了。是否可以让一个 shell 脚本启动一个 python 解释器“中流”,即:
#!/bin/bash
#shell stuff..
set +e
VAR=aabb
for i in a b c; do
echo $i
done
# same file!
#!/usr/bin/env python
# python would be given this fd which has been seek'd to this point
import sys
print ("xyzzy")
sys.exit(0)
【问题讨论】: