Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Drop-in cross-platform OSX “open” functionality
#!/bin/bash
# Cross-platform Darwin open(1)
# Simply add this function definition above any OSX script that uses the “open” command
# For additional information on the “open” command, see https://developer.apple.com/library/mac/#documentation/darwin/reference/manpages/man1/open.1.html
open() {
if [[ $(uname) = "Darwin" ]]
then /usr/bin/open "$@" #OS X
else xdg-open "$@" &> /dev/null & # credit: http://stackoverflow.com/questions/264395
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment