Running a .py file iteratively at the terminal

Philip Keogh pkeogh at compusoftcs.com
Mon Jan 26 22:30:48 CET 2015


On Mon, 26 Jan 2015, varun7rs at gmail.com wrote:
> Thanks a lot Mark but that would be a bit trivial. How can I run the
> same file multiple times? Or if I need to run two commands:
> srva at hades:~$ python NFV_nw_eu_v3_14_1_15.py --output eu_v3_14_1_15
> --demand demands_v3_21_1_15.xml --xml nobel-eu.xml
>srva at hades:~$ python NFV_v3_7_10_14.py -l log --lp --xml eu_v3_14_1_15.xml 
> repeatedly, how can I do that? Can I write a script to perform this
> function?If so, can you please help me with it?  The first command
> generates an output file eu_v3 and the second file feeds it to the
> solver. This is what I intend to do multiple times. I hope I have
> explained it this time in a much better way. I'm sorry English is my
> second language and I have some problems in expressing myself at
> times.
> 
> Thank You
> 

Have you read about Bash shell brace expansion, or a one-liner loop? A
simple wrapper script could easily accomplish what you seem to be
attempting to do.

For more, see:
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html
http://www.linuxjournal.com/content/bash-brace-expansion
http://wiki.bash-hackers.org/syntax/expansion/brace
http://tldp.org/LDP/abs/html/loops1.html


More information about the Python-list mailing list