Created
September 17, 2013 06:12
-
-
Save gb-swatanabe/6590650 to your computer and use it in GitHub Desktop.
環境変数PATHへの追加削除(重複排除) - CentOS 6.x /etc/profileより抜粋
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: | |
pathmunge () { | |
case ":${PATH}:" in | |
*:"$1":*) | |
;; | |
*) | |
if [ "$2" = "after" ] ; then | |
PATH=$PATH:$1 | |
else | |
PATH=$1:$PATH | |
fi | |
esac | |
} | |
: | |
# Path manipulation | |
if [ "$EUID" = "0" ]; then | |
pathmunge /sbin | |
pathmunge /usr/sbin | |
pathmunge /usr/local/sbin | |
else | |
pathmunge /usr/local/sbin after | |
pathmunge /usr/sbin after | |
pathmunge /sbin after | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment