Linux - python vs sh
Krisztian Kepes
Kepes.Krisztian at peto.hu
Thu Jul 17 04:01:47 EDT 2003
Hi !
I want to list my rpm database to file with this:
#!/bin/sh
file="./allrpm.txt"
nr=1
for rpmname in `rpm -qa`
do
echo '>>>>>>>>>>>>>>>' >>$file
echo "$nr." >>$file
echo "Name: $rpmname" >>$file
echo "" >>$file
info=`rpm -qi $rpmname`
echo "$info" >>$file
echo "" >>$file
nr=`expr $nr + 1`
done
But it have two error:
1. the $nr is not incremented
2. the rpm detailed info is not writed to the file
I want to change it to py code. I see an perl code:
@rpmlist= rpm -qa
It is get the rpm's output.
But how I get the rpm's output in my py program ?
list= rpm -qa
????
Please send me an simple example !
Thx:
KK
More information about the Python-list
mailing list