Skip to content

Instantly share code, notes, and snippets.

@gb-swatanabe
Created September 17, 2013 06:12
Show Gist options
  • Save gb-swatanabe/6590650 to your computer and use it in GitHub Desktop.
Save gb-swatanabe/6590650 to your computer and use it in GitHub Desktop.
環境変数PATHへの追加削除(重複排除) - CentOS 6.x /etc/profileより抜粋
:
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