Reputation: 63
I have written some little code but it seems not to work as I want to.
#!/bin/bash
while true; do
xdg-open test.mp4
inotifywait -e modify test.mp4
done
Simply I want to open a .mp4 file but it can be replaced anytime and if it replaced one day the script should be recognize it and restart the .mp4 file again.
I hope someone can help me.
Upvotes: 0
Views: 90
Reputation: 1451
Use inotifywait
instead of inotifywatch
:
while true; do
inotifywait -e modify file.mp4
xdg-open file.mp4
done 2>&1 > /dev/null & disown ; exit
Basically it xdg-open file.mp4
, sleeps until modify, reopens it...
Upvotes: 2