mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
Respect original PATH definitions on install
The exporting of PATH as a fixed string would clobber any system-wide paths added to env after installation. Instead, we now read any existing PATH exports from previous config files and copy those from the user's bash config, or else default to a basic prepend-only example that respects the system environment.
This commit is contained in:
parent
7f07facf41
commit
152aab69bc
1 changed files with 15 additions and 6 deletions
|
|
@ -23,14 +23,23 @@ fi
|
|||
|
||||
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
|
||||
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
|
||||
sed -i -e "/^ZSH=/ c\\
|
||||
sed -e "/^ZSH=/ c\\
|
||||
ZSH=$ZSH
|
||||
" ~/.zshrc
|
||||
" ~/.zshrc | tee ~/.zshrc
|
||||
|
||||
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
|
||||
sed -i -e "/export PATH=/ c\\
|
||||
export PATH=\"$PATH\"
|
||||
" ~/.zshrc
|
||||
ORIG_RC_FILES=`ls ~/.bashrc ~/.zshrc.pre-oh-my-zsh 2>/dev/null` || :
|
||||
if [ "$ORIG_RC_FILES" ]
|
||||
then
|
||||
ORIG_PATHS=`grep -sh '^export PATH=' $ORIG_RC_FILES` || :
|
||||
fi
|
||||
|
||||
if [ "$ORIG_PATHS" ]
|
||||
then
|
||||
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
|
||||
nl=$'\n'
|
||||
sed -e '/^export PATH=/ c\
|
||||
'"${ORIG_PATHS//$nl/\\$nl}" ~/.zshrc | tee ~/.zshrc
|
||||
fi
|
||||
|
||||
if [ "$SHELL" != "$(which zsh)" ]; then
|
||||
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue