LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Please help to explain the syntax for 'update-alternatives' (https://www.linuxquestions.org/questions/linux-newbie-8/please-help-to-explain-the-syntax-for-update-alternatives-168602/)

davidas 04-10-2004 07:51 PM

Please help to explain the syntax for 'update-alternatives'
 
Usage: update-alternatives --install <link> <name> <path> <priority>
[--slave <link> <name> <path>] ...

<name> is the name in /etc/alternatives.
<path> is the name referred to.
<link> is the link pointing to /etc/alternatives/<name>.
<priority> is an integer; options with higher numbers are chosen.

I'm trying to update my /usr/bin/vi to use gvim instead of vim. Currently, /usr/bin/vi is a symbolic link pointing to /etc/alternatives/vi.

david:/home/david# ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 Apr 3 11:49 /usr/bin/vi -> /etc/alternatives/vi

david:/home/david# update-alternatives --display vi
vi - status is auto.
link currently points to /usr/bin/vim
/usr/bin/nvi - priority 30
slave vi.1.gz: /usr/share/man/man1/nvi.1.gz
/usr/bin/vim - priority 120
slave vi.1.gz: /usr/share/man/man1/vim.1.gz
Current `best' version is /usr/bin/vim.

So, I tried this command
Code:

update-alternatives --install /usr/bin/vi vi /usr/bin/gvim 130 --slave /usr/bin/vi vi.1.gz /usr/share/man/man1/vi.1.gz
Entering this command will return me the help file on update-alternatives instead. I suspect the syntax for my --slave arguement is wrong, most likely the <link>. What link is pointing to vi.1.gz , since the <name> is vi.1.gz and is pointing to <path> /usr/share/man/man1/vim.1.gz ?

I've read the man pages, but it doesn't elaborate further on the usage of the --slave arguement.

Please advise.

Thanks !

davidas 04-11-2004 06:22 AM

Update: In addition to the above, I also changed the symbolic link in /etc/alternatives by hand, without using update-alternatives :

Code:

ln -sf /usr/bin/gvim /etc/alternatives/vi
However, even in /etc/alternatives directory itself, when I did a
Code:

vi <filename>
, the editor that is loaded is still vim (instead of gvim.

Any advice, please?

Thanks !
PS. Can't seem to find anything that elaborate on update-alternatives at Debian homepage.


All times are GMT -5. The time now is 02:20 AM.