mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Provide pathmunge for /etc/profile.d scripts
This commit is contained in:
parent
1120f97305
commit
40cafea102
1 changed files with 34 additions and 0 deletions
|
|
@ -33,4 +33,38 @@ plugins=(git)
|
|||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# Provide pathmunge for /etc/profile.d scripts
|
||||
pathmunge()
|
||||
{
|
||||
if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)" ; then
|
||||
if [ "$2" = "after" ] ; then
|
||||
PATH=$PATH:$1
|
||||
else
|
||||
PATH=$1:$PATH
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_src_etc_profile_d()
|
||||
{
|
||||
# Make the *.sh things happier, and have possible ~/.zshenv options like
|
||||
# NOMATCH ignored.
|
||||
emulate -L ksh
|
||||
|
||||
|
||||
# from bashrc, with zsh fixes
|
||||
if [[ ! -o login ]]; then # We're not a login shell
|
||||
for i in /etc/profile.d/*.sh; do
|
||||
if [ -r "$i" ]; then
|
||||
. $i
|
||||
fi
|
||||
done
|
||||
unset i
|
||||
fi
|
||||
}
|
||||
_src_etc_profile_d
|
||||
|
||||
unset -f pathmunge _src_etc_profile_d
|
||||
|
||||
# Customize to your needs...
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue