コマンドの出力がシンボリックリンクの出力と一致しません。

コマンドの出力がシンボリックリンクの出力と一致しません。

私はRaspberry PiでRASPBIANを使用しています。私は「apropos」コマンドが「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....***

明らかに、aproposはwhatisへの象徴的なリンクです。

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

どうすればこれが起こりますか?

ベストアンサー1

実行中の実行可能ファイルは呼び出しコマンドライン全体を知り、呼び出された名前に基づいてその動作を変更できます。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また、処理中にフラグを確認し、フラグを設定するかどうかによって異なる動作をする場所が約12個あります。

おすすめ記事