Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to add a command to notepadd++ intallation using update-alternatives with wine command:

sudo update-alternatives --install /usr/bin/notepad notepad "/<path_to_wine>/bin/wine C:\\Program\ Files\\Notepad++\\notepad++.exe" 100

But I get an error:

update-alternatives: error: alternative path //bin/wine C:\Program\ Files\Notepad++\notepad++.exe doesn't exist

Is there a way to add program arguments to update-alternatives path parameter?

Note: is my teamviewer wine installation: /opt/teamviewer9/tv_bin/wine/

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The best way to do this would be to create a simple shell script wrapper for the command that you want to invoke, and then add the path to the shell script to the alternatives system.

For your case, you could create a shell script at /usr/local/bin/wine-notepad++ (or whatever path and name you prefer) with the following contents:

#!/bin/sh
exec /opt/teamviewer9/tv_bin/wine/bin/wine C:\\Program\ Files\\Notepad++\\notepad++.exe "$@"

You can then add the path to this script to the alternatives system using update-alternatives if you want, with

sudo update-alternatives --install /usr/bin/notepad notepad /usr/local/bin/wine-notepad++ 100

Note that alternatives in Ubuntu are implemented with symbolic links, so this is a very similar question and answer to How can I make a symbolic link to run a program with command line argument?.

share|improve this answer
    
It works! I added it to nautilus "open with" menu using Ubuntu Tweak. Thank you –  Ivan Cachicatari May 12 at 16:22

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.