Created
December 5, 2014 16:35
-
-
Save agrberg/7a09dea9a4ac545decb7 to your computer and use it in GitHub Desktop.
Helpers for `afplay` OS X
This file contains 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
function pid_for_name() { | |
ps -A | grep -m1 $1 | awk '{print $1}' | |
} | |
function pause_af { | |
kill -17 $(pid_for_name afplay) | |
} | |
function play_af { | |
kill -19 $(pid_for_name afplay) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This wasn't working for me, I had to:
function pid_for_name() {
ps -A | grep -m2 $1 | tail -1 | awk '{print $1}'
}
I don't know why our systems would report the grep process and afplay in a different order.