Skip to content

Instantly share code, notes, and snippets.

@jonathanvdc
Last active July 29, 2017 08:29
Show Gist options
  • Save jonathanvdc/f2fa3b5f8d5ece27b877fae439d944d0 to your computer and use it in GitHub Desktop.
Save jonathanvdc/f2fa3b5f8d5ece27b877fae439d944d0 to your computer and use it in GitHub Desktop.
A script that generates a wrapper script to run mono on an executable.
#!/usr/bin/env bash
if [ $# -lt 2 ]; then
echo "Usage: mono-ln filename.exe script-path.sh [readlink|greadlink]"
fi
if [ $# -lt 3 ]; then
readlink_name="readlink"
else
readlink_name=$3
fi
# Build a bash script that runs $1 at $2
echo "#!/usr/bin/env bash" > $2
echo >> $2
echo "# This script explicitly calls 'mono' to run '$1'" >> $2
echo "mono \"\$(dirname \"\$($readlink_name -f \"\$0\")\")/$1\" \$@" >> $2
chmod +x $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment