我想从shell运行多个Python脚本。我使用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
但它不起作用。如何编写shell脚本?
答案 0 :(得分:3)
按顺序运行:
#!/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
要并行运行它们:
#!/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 &
根据需要,使用重定向(>或>>)重定向stdout和stderr。