![](/img/trans.png)
[英]linux shell script: run multiple commands on background and dont kill even if script ends
[英]Linux bash shell: run multiple commands in background separated with ||
我尝试在后台运行多个命令,但这些命令里面有多个命令
startFFMPEG=$(/root/bin/ffmpeg -i cmd1__________ || /root/bin/ffmpeg -i cmd2__________ || /root/bin/ffmpeg -i cmd3__________ || )
$startFFMPEG
echo "PRINT THIS so i can continue to run another commands"
所以我尝试做的是:
当我运行 bash 脚本时,它将运行包含多个命令的 startFFMPEG(如果 1 个失败将启动另一个)。
但我不想等待他们,我希望脚本在等待之前继续。
所以在我的情况下,永远不会显示 echo "PRINT"
听起来你想要一个可以在后台运行的 function:
startFFMPEG() {
/root/bin/ffmpeg -i cmd1__________ \
|| /root/bin/ffmpeg -i cmd2__________ \
|| /root/bin/ffmpeg -i cmd3__________
}
startFFMPEG &
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.