Created
March 5, 2013 17:57
-
-
Save bl0ckeduser/5092461 to your computer and use it in GitHub Desktop.
Open .exe files intelligently, version 2
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
# Open .exe files in mono or wine depending | |
# on what the file(1) command says. Useful | |
# for practical double-clicking from a | |
# file manager. | |
if [ ! "$1" ] | |
then | |
echo "Use: $0 file" | |
exit 1 | |
fi | |
if [ ! -e "$1" ] | |
then | |
echo "no such file $1" | |
exit 1 | |
fi | |
DEST=$(dirname "$1") | |
FILE=$(basename "$1") | |
cd "$DEST" | |
if (file -b "$FILE" | grep -i mono) | |
then | |
mono "$FILE" & | |
else | |
wine "$FILE" & | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment