středa 16. dubna 2014

system-wide $PATH change (CentOS)

Thanks to this source.

create /etc/profile.d/custompath.sh with:

pathmunge () {
        eval dOPATH="\$${1}"
        if ! echo ${dOPATH} | /bin/egrep -q "(^|:)$2($|:)" ; then
           if [ "$3" = "after" ] ; then
              export ${1}=${dOPATH}:$2
           else
              export ${1}=$2:${dOPATH}
           fi
        fi
}
if [ "$LOGNAME" != "root" ]
then
  pathmunge PATH . # for those who like it
  pathmunge PATH /usr/local/texlive/2013/bin/x86_64-linux append
fi

remarks
  • custompath.sh does not need to be executable
  • definice of pathmunge has to be present, it does not propagate from /etc/profile

Žádné komentáře:

Okomentovat