【发布时间】:2021-05-27 13:00:30
【问题描述】:
我在 python 环境中需要这个。示例here on my Github
我有一个文件requirements.in,我想看看它是否有变化。我向其中添加库,保存后将运行编译和安装脚本。
我使用pip-compile 将需求编译到requirements.text 文件中。然后使用 pip 安装此需求文件中的所有内容。理想情况下,我想创建一个也运行 jupyter notebook 的捆绑脚本。
目前我使用了python库“when-changed”并采用了这种方法:
#!/bin/bash
jupyter notebook &
when-changed requirements_dev.in pip-compile requirements_dev.in && requirements_dev.in pip install -r requirements_dev.txt && echo 'Installed requirements'
这种方法的问题是它只编译需求而不安装它或执行echo语句。我猜这是因为when-changedlibrary 只能执行一个命令。
因此我的问题是:如何查看文件并执行多个命令? (不一定是 bash 脚本。也可以是 python 或任何最适合的)
【问题讨论】:
标签: python bash shell scripting command