我想将其添加vimb
到 中的默认浏览器x-www-browser
。我在 中没有看到它update-alternatives --config x-www-browser
,所以我认为我必须--install
这样做。经过一段时间的阅读man update-alternatives
和搜索,我想到了这一点:
update-alternatives --install /usr/local/bin/vimb x-www-browser /usr/local/bin/vimb 30
这似乎很愚蠢(重复的参数),但我认为我没有正确理解手册。我到底要传递link
什么path
?
COMMANDS
--install link name path priority [--slave link name path]...
link is the generic name for the master link,
name is the name of its symlink in the alternatives directory, and
path is the alternative being introduced for the master link.
TERMINOLOGY
alternatives directory
A directory, by default /etc/alternatives, containing the symlinks.
alternative name
The name of a symbolic link in the alternatives directory.
alternative (or alternative path)
The name of a specific file in the filesystem, which may be made accessible via
a generic name using the alternatives system.
我是否必须复印一份/usr/local/bin/vimb
或者/etc/alternatives
怎样?
答案1
在我看来,手册页有点令人困惑,但关键部分似乎是
--install link name path priority [--slave link name path]...
Add a group of alternatives to the system. link is the generic
name for the master link, name is the name of its symlink in the
alternatives directory, and path is the alternative being intro‐
duced for the master link.
其中generic name
在部分中描述TERMINOLOGY
为
generic name (or alternative link)
A name, like /usr/bin/editor, which refers, via the alternatives
system, to one of a number of files of similar function.
而实际的可执行目标被称为path
alternative (or alternative path)
The name of a specific file in the filesystem, which may be made
accessible via a generic name using the alternatives system.
所以你的情况需要
update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/local/bin/vimb 30
答案2
一些实验向我展示了参数的正确组合。事实证明link
必须是/usr/bin/x-www-browser
,所以最终命令变成:
update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/local/bin/vimb 30
我还不明白为什么update-alternatives
需要两者/usr/bin/x-www-browser
。x-www-browser
返回
where x-www-browser
前者,这意味着两者都指向同一个位置。无论如何,这是一个可行的解决方案,但我仍然很高兴看到对事物工作原理有更深入了解的人的回答。