写一个.sh文件自动运行python程序a和b,要求先运行a再运行b
时间: 2024-02-21 12:59:03 浏览: 164
好的,以下是一个简单的实现:
```bash
#!/bin/bash
# 运行程序a
python a.py
# 运行程序b
python b.py
```
将上述代码保存为一个名为 `run.sh` 的文件,然后将a.py和b.py放在同一个目录下,给 `run.sh` 文件添加执行权限:
```bash
chmod +x run.sh
```
最后在终端中运行 `run.sh` 文件即可自动运行程序 a 和 b,且先运行 a,再运行 b:
```bash
./run.sh
```
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)