I'm trying to write a Python script that reads lines of strings from a file and executes a bash-shell command with each line as parameter:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
lines = [line.strip() for line in open('/tmp/i586rpm.txt')]
for rpm in lines:
try:
s = os.system("rpm -qip") % lines
except Exception:
print "Something wrong"
But I always get an error. I think that there is something wrong with % lines.
Any ideas?