4

I have installed libstdc++6-4.7-doc on a machine with Ubuntu, so I could look up for things like std::pair from the command line.

Is there a way to search for the same std:: entries without specifying it? E.g. by typing man pair I would like to open the same man pages as typing man std::pair would open but only when there would no other man pages for these keyword.

1 Answer 1

1

In bash, you can create a function to achieve this, eg.

function kman(){ str="std::$1"; man $str }

Now, instead of using man, use kman for your std:: terms:

~$ kman pair
 No manual entry for std::pair

A workaround but serves the purpose of saving typing std:: every time.

3
  • Of course that's one way to do it but I really need it to execute man pair (though it can be overridden man command).
    – syntagma
    Commented Dec 28, 2014 at 1:05
  • @REACHUS An alternative is to go to the manpages directory and create symlinks to the respective files and removing the std:: in the link name. Another alternative is to amend the man source code and add your own switch to take care of the std:: prefix. I suppose the first one would be easier.
    – Ketan
    Commented Dec 28, 2014 at 17:46
  • 4
    If you're OK with overriding the man command: This will show the man page for std::$1, and if that fails, it will run man normally: function man() { command man std::"$1" 2>/dev/null || command man "$@"; } Commented Dec 31, 2014 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .