Monthly Archives: February 2015

How to make a mono program start without the full path in Linux for Raspberry Pi

Scenario

You want to run your mono program from the command line without typing the full path to it.

Solution

You can create a shell script that will call mono (after you have it installed). The shell script will pass any parameters off to the program. The script itself will have to have permisssions. In my example below I’m going to setup a shell script to start a console application called “http” that downloads files for a specified URL.

Shell Script

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

The above script assumes that the mono executable is compiled with an exe extension and also assumes that mono is
in the global path. If mono is not, you will need to include the full path to mono here.

The last piece you need to run your executable is to give the shell script permissions. In my case, I named the
script “http” and then used this command to give it execute permissions.

Command Line

chmod +x http