Created
July 9, 2012 08:34
-
-
Save MattiSG/3075116 to your computer and use it in GitHub Desktop.
Drop-in cross-platform OSX “open” functionality
This file contains 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
#!/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