Skip to content

Instantly share code, notes, and snippets.

@gevans
Created September 26, 2014 00:37
Show Gist options
  • Save gevans/317f02d7f8a244d18cb6 to your computer and use it in GitHub Desktop.
Save gevans/317f02d7f8a244d18cb6 to your computer and use it in GitHub Desktop.
Let's just run this in the office and see what happens...
#!/usr/bin/env bash
video_url='https://www.youtube.com/watch?v=dQw4w9WgXcQ'
exists() {
which "$1" &> /dev/null
}
os="$(uname)"
if [ "$os" = 'Darwin' ]; then
open -g "$video_url"
else
if exists 'chrome'; then
chrome "$video_url"
elif exists 'google-chrome'; then
google-chrome "$video_url"
elif exists 'firefox'; then
firefox "$video_url"
elif exists 'iceweasel'; then
iceweasel "$video_url"
else
echo "$video_url" > /home/*/look-at-this-$$.txt
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment