Fix PATH and MANPATH manipulation in .bashrc
This commit is contained in:
parent
33eac53475
commit
a13a965961
1 changed files with 25 additions and 24 deletions
|
@ -44,40 +44,41 @@ bashrc_customize_paths() {
|
||||||
# Prevent path_helper from messing with the PATH when starting tmux.
|
# Prevent path_helper from messing with the PATH when starting tmux.
|
||||||
# See: https://superuser.com/a/583502
|
# See: https://superuser.com/a/583502
|
||||||
if [ "$(uname)" == "Darwin" ]; then
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
export PATH=""
|
PATH=""
|
||||||
source /etc/profile
|
source /etc/profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add custom bin dirs to PATH if they exist and are not already in PATH.
|
# Add custom bin dirs to PATH if they exist and are not already in PATH.
|
||||||
while read p
|
while read p; do
|
||||||
do
|
if [ -d "$p" ] && [[ ":$PATH:" != *":$p:"* ]]; then
|
||||||
if [ -d "$p" ] && [[ ":$MANPATH:" != *":$p:"* ]]; then
|
PATH="$p:$PATH"
|
||||||
MANPATH="$p:$MANPATH"
|
|
||||||
fi
|
fi
|
||||||
done <<-EOF
|
done <<EOS
|
||||||
$prefix/share/man
|
$prefix/bin
|
||||||
$prefix/opt/coreutils/libexec/gnuman
|
$prefix/opt/man-db/libexec/bin
|
||||||
EOF
|
$prefix/opt/coreutils/libexec/gnubin
|
||||||
|
$prefix/opt/gnu-sed/libexec/gnubin
|
||||||
# If MANPATH is not yet defined, initialize it with the contents of
|
$HOME/.local/bin
|
||||||
# `manpath`.
|
$HOME/bin
|
||||||
if [ -z ${MANPATH+x} ]; then
|
EOS
|
||||||
export MANPATH=$(manpath)
|
export PATH
|
||||||
fi
|
|
||||||
|
|
||||||
# Prepend custom man directories to MANPATH if they exist, so that we get
|
# Prepend custom man directories to MANPATH if they exist, so that we get
|
||||||
# correct man page entries when multiple versions of a command are
|
# correct man page entries when multiple versions of a command are
|
||||||
# available.
|
# available.
|
||||||
while read p
|
MANPATH=$(MANPATH= manpath)
|
||||||
do
|
while read p; do
|
||||||
if [ -d "$p" ] && [[ ":$PATH:" != *":$p:"* ]]; then
|
if [ -d "$p" ] && [[ ":$MANPATH:" != *":$p:"* ]]; then
|
||||||
PATH="$p:$PATH"
|
MANPATH="$p:$MANPATH"
|
||||||
fi
|
fi
|
||||||
done <<-EOF
|
done <<EOS
|
||||||
$prefix/opt/coreutils/libexec/gnubin
|
$prefix/share/man
|
||||||
$HOME/.local/bin
|
$prefix/opt/man-db/libexec/man
|
||||||
$HOME/bin
|
$prefix/opt/coreutils/libexec/gnuman
|
||||||
EOF
|
$prefix/opt/gnu-sed/libexec/gnuman
|
||||||
|
$HOME/.local/share/man
|
||||||
|
EOS
|
||||||
|
export MANPATH
|
||||||
}
|
}
|
||||||
|
|
||||||
bashrc_customize_aliases() {
|
bashrc_customize_aliases() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue