【发布时间】:2012-01-27 14:44:20
【问题描述】:
我有以下 Python 行:
import subprocess
subprocess.Popen("egrep -r --exclude=*{.git,.svn}* \"text\" ~/directory", stdout=subprocess.PIPE, shell=True).communicate()[0]
不幸的是,bash 完全忽略了 --exclude=*{.git,.svn}* 标志。
我已将问题范围缩小到花括号。 --exclude=*.git* 将通过python的popen工作,但是在引入花括号的那一刻,我很无助。有什么建议吗?
注意:我尝试使用 Python 的 command 库运行该命令,它会产生完全相同的输出 -- 以及完全相同的被忽略 --exclude 标志。
【问题讨论】: