简体   繁体   English

如何一个接一个地从外壳运行多个python脚本

[英]How to run multiple python scripts from shell one after another

I want to run multiple Python scripts from shell. 我想从外壳运行多个Python脚本。 I used pythonDim.sh script to do the same. 我使用pythonDim.sh脚本执行了相同的操作。

#!/usr/bin/python
/home/path_to_script/dimAO.py
/home/path_to_script/dimA1.py
/home/path_to_script/dimA2.py
/home/path_to_script/dimA3.py

But it's not working. 但这不起作用。 How to write the shell script? 如何编写shell脚本?

To run sequentially: 要顺序运行:

#!/bin/bash
/home/path_to_script/dimAO.py
/home/path_to_script/dimA1.py
/home/path_to_script/dimA2.py
/home/path_to_script/dimA3.py

To run them all in parallel: 要并行运行它们:

#!/bin/bash
/home/path_to_script/dimAO.py &
/home/path_to_script/dimA1.py &
/home/path_to_script/dimA2.py &
/home/path_to_script/dimA3.py &

Use redirection (> or >>) to redirect stdout and stderr, as desired. 根据需要使用重定向(>或>>)重定向stdout和stderr。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM