Skip to content

Commit

Permalink
Check that the man command exists before using it
Browse files Browse the repository at this point in the history
On a minimal system image, man might not be installed. 'command' and
'where' are shell builtins for bash and tcsh, respectively, so
shouldn't make it noticeably slower.
  • Loading branch information
jabl committed Dec 10, 2018
1 parent 59b8157 commit 96b300d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion files/fgi-manpath.csh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
if ! $?MANPATH then
setenv MANPATH
endif
setenv MANPATH "${MANPATH}:"`man -w`
if (`where man` != "") then
setenv MANPATH "${MANPATH}:"`man -w`
endif

4 changes: 3 additions & 1 deletion files/fgi-manpath.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
# Set the manpath explicitly, so MANPATH overwrites won't hide system man pages

export MANPATH=$MANPATH:`man -w`
if mancmd=$(command -v man); then
export MANPATH=$MANPATH:$(${mancmd} -w)
fi

0 comments on commit 96b300d

Please sign in to comment.