python - Python2 grep command with pipes -
i need identify environment variable in following script.
env | grep -i timezone | cut -c14-18
what doing wrong? tried:
command = ['env'] command2 = ['grep'] command2.append('-i') command2.append('timezone') command3 = ['cut'] command3.append('-c14-18') process=subprocess.popen(command,stdout=subprocess.pipe,shell=true) process2=subprocess.popen(command2,stdin=process.stdout,stdout=subprocess.pipe) process3=subprocess.popen(command3,stdin=process2.stdout,stdout=subprocess.pipe) (out,err) = process3.communicate() print 'output :', out
Comments
Post a Comment