A. Red Hat, CentOS, and Fedora Linux has a pathmunge function defined in /etc/profile file. It will add the directories one by one to the default PATH for the root user.
pathmunge() function is defined in /etc/profile
pathmunge () {Path manipulation done using pathmunge:
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulationAs long as you are using Red Hat or CentOS / Fedora Linux, you can use pathmunge. It is best to avoid this function if you need run a shell script on diffrent distributions. I recommend using export bash command for modifying PATH variable.
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
No comments:
Post a Comment