python - Piping commands in plink on windows command line -
i using python automate installation of rpms on linux box. m using plink connect linux box. first need info of installed rpms on box. command
os.system('plink root@server -pw pass rpm -qa|grep string > rpm.txt')
here command line interpreters '|'
cmd command , throws error "grep not recognized internal or external command, operable program or batch file"
also rpm.txt
created on machine instead on linux box.
anyway can use '|'
, makesure 'rmp.txt'
created in linux box?
try this:
ff=subprocess.popen("plink root@server -pw pass rpm -qa",shell=false,stdin=subprocess.pipe) ff.communicate("grep string > rpm.txt")
a
Comments
Post a Comment