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

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -