我在我的覆盆子皮上使用RASPBIAN。我发现,命令“意外”是命令"wahtis“的一个符号链接。但是,当使用相同的参数时,这些命令的输出不匹配:
$ whatis delete
delete: nothing appropriate.但
$ apropos delete
argz_delete (3) - functions to handle an argz list
delete_module (2) - unload a kernel module
dphys-swapfile (8) - set up, mount/unmount, and delete an swap file
git-branch (1) - List, create, or delete branches
git-replace (1) - Create, list, delete refs to replace objects
git-symbolic-ref (1) - Read, modify and delete symbolic refs
git-tag (1) - Create, list, delete or verify a tag object signed
***output is truncated to save space....***很明显,这是一个象征性的联系。
pi@raspberry:~ $ which apropos
/usr/bin/apropos
pi@raspberry:~ $ ls -l /usr/bin/apropos
lrwxrwxrwx 1 root root 6 Aug 24 2017 /usr/bin/apropos -> whatis怎么会发生这种事?
发布于 2018-04-30 20:09:04
正在运行的可执行文件将知道完整的调用命令行,并可以根据调用的名称修改其行为。对于apropos/whatis的特定实例,您可以看到在源代码中 (链接的最近版本的第895行),首先要确定命令是否以名称apropos调用:
int main (int argc, char *argv[])
{
#ifdef HAVE_ICONV
char *locale_charset;
#endif
int status = OK;
program_name = base_name (argv[0]);
if (STREQ (program_name, APROPOS_NAME)) {
am_apropos = 1;
argp_program_version = "apropos " PACKAGE_VERSION;
} else {在处理过程中,大约有十几个地方检查am_apropos标志,根据是否设置了它,它们的行为有所不同。
https://unix.stackexchange.com/questions/440987
复制相似问题