I need to store the result of a shell command that I executed in a variable, but I couldn\'t get it working. I tried like:
import os
call = os.system(\"
os.popen works for this. popen - opens a pipe to or from command. The return value is an open file object connected to the pipe, which can be read. split('\n') converts the output to list
import os
list_of_ls = os.popen("ls").read().split('\n')
print list_of_ls
import os
list_of_call = os.popen("cat syscall_list.txt | grep f89e7000 | awk '{print $2}'").read().split('\n')
print list_of_call