mirror of
https://github.com/meineerde/dotfiles.git
synced 2026-02-23 12:01:44 +00:00
Find correct python bin path with multiple pythons installed by Homebrew
This commit is contained in:
parent
045bddd3a4
commit
7bb8ad691b
33
.bashrc
33
.bashrc
@ -88,23 +88,40 @@ case `uname` in
|
|||||||
fi
|
fi
|
||||||
function fullscreen() { printf "\e[3;0;0;t\e[8;0;0t"; return 0; }
|
function fullscreen() { printf "\e[3;0;0;t\e[8;0;0t"; return 0; }
|
||||||
alias ls='ls -G'
|
alias ls='ls -G'
|
||||||
for p in /usr/local/*/bin /usr/*/bin /usr/local/Cellar/python/*/bin; do
|
|
||||||
export PATH=$p:$PATH
|
python="$(which python)"
|
||||||
|
python_path=""
|
||||||
|
# Find correct python bin path with multiple Pythons installed by Homebrew
|
||||||
|
if [[ $(echo "$python" | grep '^/usr/local/bin') ]]; then
|
||||||
|
# Python comes from Homebrew
|
||||||
|
target=$(readlink "$python")
|
||||||
|
if [[ $? ]]; then
|
||||||
|
# the python binary is a symlink
|
||||||
|
python_path=$(cd "$(dirname "$python")" && cd "$(dirname "$target")" && pwd)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
for p in "$python_path" /usr/local/*/bin /usr/*/bin; do
|
||||||
|
if [[ -n "$p" ]]; then
|
||||||
|
export PATH=$p:$PATH
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
unset p
|
|
||||||
|
unset p python python_path
|
||||||
|
|
||||||
gitx() { open -a GitX $@; }
|
gitx() { open -a GitX $@; }
|
||||||
pdfman() { man -t $1 | open -a /Applications/Preview.app -f; }
|
pdfman() { man -t $1 | open -a /Applications/Preview.app -f; }
|
||||||
|
|
||||||
# Bash completion
|
# Bash completion
|
||||||
if [ -f `brew --prefix`/etc/bash_completion ]; then
|
if [ -f `brew --prefix`/etc/bash_completion ]; then
|
||||||
. `brew --prefix`/etc/bash_completion
|
. `brew --prefix`/etc/bash_completion
|
||||||
fi
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
Linux)
|
Linux)
|
||||||
PATH=$PATH:/var/lib/gems/1.8/bin:/var/lib/gems/1.9/bin
|
PATH=$PATH:/var/lib/gems/1.8/bin:/var/lib/gems/1.9/bin
|
||||||
alias ls='ls --color=auto'
|
alias ls='ls --color=auto'
|
||||||
|
|
||||||
# enable bash completion in interactive shells
|
# enable bash completion in interactive shells
|
||||||
if [ -f /etc/bash_completion ]; then
|
if [ -f /etc/bash_completion ]; then
|
||||||
. /etc/bash_completion
|
. /etc/bash_completion
|
||||||
@ -113,11 +130,11 @@ case `uname` in
|
|||||||
SunOS)
|
SunOS)
|
||||||
stty istrip
|
stty istrip
|
||||||
export PATH=/opt/csw/bin:/opt/sfw/bin:$PATH:/etc
|
export PATH=/opt/csw/bin:/opt/sfw/bin:$PATH:/etc
|
||||||
|
|
||||||
if [ -f /etc/bash_completion ]; then
|
if [ -f /etc/bash_completion ]; then
|
||||||
. /etc/bash_completion
|
. /etc/bash_completion
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# home key
|
# home key
|
||||||
bind '"\e[1~":beginning-of-line'
|
bind '"\e[1~":beginning-of-line'
|
||||||
# del key
|
# del key
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user