From 96b300d94674b7549c65ce07381f143ca75d4a6f Mon Sep 17 00:00:00 2001 From: Janne Blomqvist Date: Mon, 10 Dec 2018 12:29:20 +0200 Subject: [PATCH] Check that the man command exists before using it 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. --- files/fgi-manpath.csh | 4 +++- files/fgi-manpath.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/files/fgi-manpath.csh b/files/fgi-manpath.csh index f073d63..e42e9f0 100644 --- a/files/fgi-manpath.csh +++ b/files/fgi-manpath.csh @@ -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 diff --git a/files/fgi-manpath.sh b/files/fgi-manpath.sh index d9cd9f0..bf9b9a2 100644 --- a/files/fgi-manpath.sh +++ b/files/fgi-manpath.sh @@ -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