Last active
July 9, 2019 11:47
-
-
Save bdelacretaz/ed9aecb922a104eb6497954242b9b591 to your computer and use it in GitHub Desktop.
Restart multiple shell commands synchronously (example)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run two video players more or less in sync | |
# assuming they start playing immediately and | |
# exit when done playing | |
while true | |
do | |
# Start all players in the background | |
# VLC settings: full screen, select the right display, quit after playback | |
/Applications/VLC.app/Contents/MacOS/VLC -f movie1.mov & | |
# Use AppleScript to run quicktime full screen | |
osascript play.scpt & | |
echo "Waiting for player jobs..." | |
jobsOutput="not empty" | |
while [[ -n "$jobsOutput" ]] | |
do | |
jobsOutput=$(jobs | grep -v ' Done') | |
sleep 1 | |
done | |
echo "Done waiting." | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment