Skip to content

Instantly share code, notes, and snippets.

@agrberg agrberg/.profile
Created Dec 5, 2014

What would you like to do?
Helpers for `afplay` OS X
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)

This comment has been minimized.

Copy link

cityismychurch commented Feb 11, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.