开发者

What is the best way to write a Batch script in?

开发者 https://www.devze.com 2023-02-20 13:11 出处:网络
I am having around 20 scripts, each produce one output file as the output which is fed back as input to the next file. I want to now provide the user with an option to restart the batch script from an

I am having around 20 scripts, each produce one output file as the output which is fed back as input to the next file. I want to now provide the user with an option to restart the batch script from any point in the script.

开发者_如何学运维

My friend suggested using make or ant having targets defined for each python script. I want to know your(advanced hackers) suggestions.

Thank you


Make works like this:

Target: dependencies
  commands

Based on your scripts, you might try this type of Makefile:

Step20: output19
  script20   #reads output19 and produces final output

Step19: output18
  script19   # reads output18 and produces output19

.. etc ..

Step2: output1
  script2   # reads output1 and produces output2

Step1:
  script1   # produces output1

That way, each script won't be run until the output from the previous step has been produced. Running make Step20 will travel down the entire chain, and start at script1 if none of the outputs exist. Or, if output15 exists, it will start running script16.

0

精彩评论

暂无评论...
验证码 换一张
取 消