wuqn yqow
wuqn yqow

Reputation: 85

Linux bash shell: run multiple commands in background separated with ||

I try to run multiple commands in background, but those commands have multiple commands inside

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" 

So what I try to make is:

When I run the bash script, it will run startFFMPEG which contains multiple comands (and if 1 fail will start another).

But I don't want to wait for them, I want the script to continue before waiting for it.

So in my case echo "PRINT" is never shown

Upvotes: 1

Views: 283

Answers (1)

glenn jackman
glenn jackman

Reputation: 247182

Kind of sounds like you want a function that you can run in the background:

startFFMPEG() {
     /root/bin/ffmpeg -i cmd1__________ \
  || /root/bin/ffmpeg -i cmd2__________ \
  || /root/bin/ffmpeg -i cmd3__________ 
}

startFFMPEG &

Upvotes: 4

Related Questions