Skip to content

Instantly share code, notes, and snippets.

@vvikramjhu
Last active August 29, 2015 14:24
Show Gist options
  • Save vvikramjhu/1a13b18fa2150e60bfcc to your computer and use it in GitHub Desktop.
Save vvikramjhu/1a13b18fa2150e60bfcc to your computer and use it in GitHub Desktop.
-bash-3.2$ cat rough.py
#!/usr/local/bin/python2.7
import subprocess
subprocess.check_call(["pwd"])
# subprocess.check_call(["grep", "-o", "entry id", "nvdcve-2.0-2012.xml", "|", "wc", "-w"])
subprocess.check_call(["grep", "-o", "entry id", "nvdcve-2.0-2012.xml", "|", "wc", "-w"])
-bash-3.2$ ./rough.py
/home/content/92/7310992/html/safeview_importer/Sat_27_Jun_2015_AM_MST
nvdcve-2.0-2012.xml:entry id
nvdcve-2.0-2012.xml:entry id
nvdcve-2.0-2012.xml:entry id
....
.....
grep: |: No such file or directory
grep: wc: No such file or directory
Traceback (most recent call last):
File "./rough.py", line 5, in <module>
subprocess.check_call(["grep", "-o", "entry id", "nvdcve-2.0-2012.xml", "|", "wc", "-w"])
File "/usr/local/lib/python2.7/subprocess.py", line 511, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['grep', '-o', 'entry id', 'nvdcve-2.0-2012.xml', '|', 'wc', '-w']' returned non-zero exit status 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment