I'm trying to create a Makefile for a small Perl utility I wrote, And I'm struggling to find out a way to find where to install my man page when make
is run as a non-root user.
I'm currently parsing the output of manpath
to find out the first path in the $HOME
directory… and it almost work fine.
Paths I've found are ~/man
and ~/share/man
The only problem is that if those directories don't exist in the first place, manpath
doesn't output any of them.
Questions
- Is there a portable way to find out where I should install the man pages in the user's $HOME directory?
- If not, which one of them should be preferred?
Best Answer
You can put the man pages in this directory:
Accessing directly
And then you can access them directly using
man
:$MANPATH
You can check what the
$MANPATH
is with the commandmanpath
, or echo out the environment variable$MANPATH
.Examples
You can add things to the MANPATH temporarily:
If you want to make this permanent then add a file in your
/etc/profile.d/
directory calledmyman.bash
with the aboveMANPATH=
line in it. This will get picked up system wide for everyone. If you want it to be just for you, then add it to your$HOME/.bash_profile
or$HOME/.bashrc
.