Timeline for How to parallelize a bash for loop and use the iteration variable for file IO
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 16, 2022 at 23:17 | answer | added | Ole Tange | timeline score: 0 | |
| Dec 8, 2022 at 18:51 | comment | added | glenn jackman | And yes, the contents of (...) is a script, so newlines are perfectly OK. | |
| Dec 8, 2022 at 18:51 | comment | added | glenn jackman | It's not really about "state". The problem appears to be that the "foo1_output..." file does not exist until foo1.py completes. Therefore, delay execution of foo2.py until foo1.py exits. | |
| Dec 8, 2022 at 15:24 | comment | added | PrinceWalnut | @muru So you're saying if I encapsulate all of my commands in () (which I assume you can do across lines) and background that one total process, then the state for one process will be constant until its iteration of the loop is complete? | |
| Dec 8, 2022 at 15:21 | comment | added | muru | I think you want something like (python foo1.py $i; python foo2.py "foo1_output${i}.file_extension"; python foo3.py "foo2_output${i}.file_extension") & - send a subshell to the background that runs all three commands in sequence | |
| S Dec 8, 2022 at 15:13 | review | First questions | |||
| Dec 9, 2022 at 7:52 | |||||
| S Dec 8, 2022 at 15:13 | history | asked | PrinceWalnut | CC BY-SA 4.0 |