- why are there links to links in system directories?
Ele oferece uma maneira flexível de escolher qual programa padrão ou versão do programa você usará. De man update-alternative
:
Debian's alternatives system aims to solve this problem. A generic name in the filesystem is shared by all files providing interchangeable functionality. The alternatives system and the system administrator together determine which actual file is referenced by this generic name. For example, if the text editors ed(1) and nvi(1) are both installed on the system, the alternatives system will cause the generic name /usr/bin/editor to refer to /usr/bin/nvi by default. The system admin‐ istrator can override this and cause it to refer to /usr/bin/ed instead, and the alternatives system will not alter this setting until explicitly requested to do so.
2, is there a command that can deference a link until reaching a non-link file?
Se você tiver o utilitário readlink
, você pode:
readlink -f link
Exemplo:
$ readlink -f /usr/bin/nawk
/usr/bin/gawk
Ou você pode usar a função Perl abs_path
do módulo de núcleo Cwd
:
$ perl -MCwd=abs_path -le 'print abs_path(shift)' /usr/bin/nawk
/usr/bin/gawk
Nota