Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Suppose you're distributing a program to run on Linux, call it Foo, and the program executable is called foo.exe (because it's a CLR program so it runs under Mono) and it needs a couple of DLLs in the same directory and maybe a later version might need some data files that it reads on startup and whatever, so relocating it to a global bin directory is a bit of hassle and it really prefers to remain in its original directory...

But the user would prefer to invoke the program by typing foo instead of mono /path/to/foo.exe.

What's the best/most usual way to provide such a short command? Can/should an install script/makefile create a one line script called foo that invokes the full path, and put the one line script in a global bin directory? If so, what should be the target bin directory, and are there any directions about exactly how to do this? Or is there a preferred alternative?

edit: The approach of creating a one line script at install time seems to work well, here's the actual install script I ended up writing:

a@a-desktop:~/ayane$ cat install.sh 
#!/bin/sh
echo mono `pwd`/ayane.exe '"$@"' >ayane
chmod +x ayane
mv ayane /usr/local/bin
share|improve this question

4 Answers 4

up vote 4 down vote accepted

I would put a link or a script in /usr/local/bin

A link if all you need to do to start foo.exe is to type the full path /my/path/foo.exe. You on the other hand would need a small shell script that calls mono /path/to/foo.exe.

share|improve this answer

I would use the Filesystem Hierarchy Standard as a guide and install your package in /opt/package_name and place your wrapper script in /usr/local/bin or allow the user to configure these choices and generate the wrapper script at install-time based on those choices. An alternative would be to put the wrapper script in the same directory as the application and add the application directory to PATH in /etc/profile, but I consider this less desirable.

share|improve this answer

The simplest way is with a Bash alias. I'm not sure if it's normal practice to add an alias to profile files though.

share|improve this answer

Use an alias

put something like

alias foo='mono /path/to/foo.exe'

into the users shell initialisation file.

share|improve this answer

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.