Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Without any DE or even X, I want to use ./my.exe to run mono my.exe, like it works with python scripts.

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

Bash has no such feature. Zsh does, you can set up aliases based on extensions:

alias -s exe=mono

This would only work in an interactive shell, however, not when a program invokes another.

Under Linux, you can set up execution of foreign binaries through the binfmt_misc mechanism; see Rolf Bjarne Kvinge. Good Linux distributions set this up automatically as part of the mono runtime package.

If you can't use binfmt_misc because you don't have root permissions, you'll have to settle for wrapper scripts.

#!/bin/sh
exec /path/to/mono "$0.exe" "$@"

Put the wrapper script in the same directory as the .exe file, with the same name without .exe.

share|improve this answer
add comment

You might be able to embed the file inside a bash script using the following guide http://www.linuxjournal.com/content/add-binary-payload-your-shell-scripts

share|improve this answer
add comment

It is possible:

  • Become root and turn on the binfmt module in your kernel with this command (you may want to add this command to your /etc/rc.local boot script, so that it will be executed on boot):

    modprobe binfmt

  • Add the line below to your /etc/fstab file:

    binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc none

  • Then, have your system run the following command on boot:

    echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register

  • Be sure to mark your .exe files as executable in the filesystem as well:

    chmod +x myprogram.exe

(from here: http://mono-project.com/Guide)

Note that this is not the recommended way, read the above mentioned Guide page and also the page on how to do application deployment for mono applications.

share|improve this answer
    
I see, truly I better make loader for each .exe I need –  Heather Sep 6 '12 at 8:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.