Skip to content

Instantly share code, notes, and snippets.

@MattiSG
Created July 9, 2012 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattiSG/3075116 to your computer and use it in GitHub Desktop.
Save MattiSG/3075116 to your computer and use it in GitHub Desktop.
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