user3000724
user3000724

Reputation: 691

In a bash script while loop, how do I end a command to continue the loop?

here is an example of my code:

#!/bin/bash

while true; do

wget www.website.com/picture.jpg

qiv picture.jpg --command -blah -blah -blah

sleep 600

done

My question is how can I kill qiv? For those unfamiliar, qiv shows an image in fullscreen mode. Therefore, this script doesn't move on until qiv is exited (manually), but I want this automatic! For those wondering, it's for a digital picture frame that pulls pictures from a network. My full script works, but I have to manually press [ESC] to let the script progress. I'm sure there's a simple command to do this, and if not, could you please explain any arguments/ commands as I'm unfortunately not very experienced with bash script.

Thank you for taking the time to read this, and thanks for any help!

Upvotes: 1

Views: 1077

Answers (1)

thom
thom

Reputation: 2332

If all else fails:

while true; do

wget www.website.com/picture.jpg

killall -9 qiv                                  #<- kill backgrounded qiv

qiv picture.jpg --command -blah -blah -blah &   #<- backgrounding new qiv

sleep 600

done

Upvotes: 1

Related Questions