Created
September 26, 2014 00:37
-
-
Save gevans/317f02d7f8a244d18cb6 to your computer and use it in GitHub Desktop.
Let's just run this in the office and see what happens...
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
#!/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