Skip to content

Instantly share code, notes, and snippets.

@bl0ckeduser
Created March 5, 2013 17:57
Show Gist options
  • Save bl0ckeduser/5092461 to your computer and use it in GitHub Desktop.
Save bl0ckeduser/5092461 to your computer and use it in GitHub Desktop.
Open .exe files intelligently, version 2
# 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