Browse code

bash_profile (heron) - v3.0 - See Versions section for details

Fred authored on01/03/2020 22:04:11
Showing1 changed files
... ...
@@ -1,14 +1,15 @@
1 1
 # Title: .bash_profile
2 2
 # Author: Frédéric CHEVALIER <f15.chevalier@gmail.com>
3
-# Version: 2.3
3
+# Version: 3.0
4 4
 # Created in: 2012-05-25
5
-# Modified in: 2019-03-10
5
+# Modified in: 2020-03-01
6 6
 
7 7
 
8 8
 #==========#
9 9
 # Versions #
10 10
 #==========#
11 11
 
12
+# v3.0 - 2020-03-01: Linuxbrew added / Miniconda added / some Python env variables removed / R env variables removed / PATH setup improved / misc updates
12 13
 # v2.3 - 2019-03-10: alias updated / R hack for medusa2 added / no ssh key usage or storage for heron
13 14
 # v2.2 - 2017-04-23: server name updated / SSH connection through screen improved / welcome message improved
14 15
 # v2.1 - 2016-07-25: bug about space corrected / exit if not interactive (due to Grid Engine)
... ...
@@ -37,10 +38,7 @@
37 38
 [[ -z "$PS1" ]] && return
38 39
 
39 40
 # Load bashrc file
40
-if [[ -f ~/.bashrc ]]
41
-then
42
-	source ~/.bashrc
43
-fi
41
+[[ -f ~/.bashrc ]] && source ~/.bashrc
44 42
 
45 43
 
46 44
 
... ...
@@ -89,14 +87,14 @@ bind 'set show-all-if-unmodified off'
89 87
 #-------#
90 88
 
91 89
 # Path variable
92
-export PATH=$HOME/local/bin:$HOME/local/share:$HOME/local/usr/local/bin:$PATH     # Personal path
90
+[[ $SHLVL -eq 1 ]] && export PATH=$HOME/local/bin:$HOME/local/share:$HOME/local/usr/local/bin:$PATH     # Personal path
91
+
92
+# Linuxbrew
93
+[[ $SHLVL -eq 1 && -d "$HOME/.linuxbrew" ]] && eval $("$HOME/.linuxbrew/bin/brew" shellenv)
93 94
 
94 95
 # Use of personal /lib* if recent OS
95
-if [[ $(lsb_release -r 2> /dev/null | cut -f 2) > 6.4 || $(grep -i "version_id" /etc/os-release 2> /dev/null | cut -d "\"" -f 2) > 6.4 ]]
96
-then
97
-    # Location of bamtools lib (source: http://www.vcru.wisc.edu/simonlab/bioinformatics/programs/install/bamtools.htm)
98
-    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/local/lib:$HOME/local/lib64"
99
-fi
96
+# Location of bamtools lib (source: http://www.vcru.wisc.edu/simonlab/bioinformatics/programs/install/bamtools.htm)
97
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/local/lib:$HOME/local/lib64"
100 98
 
101 99
 # Special paths for perseus, medusa and nodes
102 100
 if [[ $HOSTNAME =~ perseus* || $HOSTNAME =~ medusa* || $HOSTNAME =~ compute.* ]]
... ...
@@ -114,10 +112,7 @@ fi
114 112
 export PERL5LIB=~/local/lib/perl5/site_perl/5.18.2/x86_64-linux/auto:~/local/lib/perl5/5.18.2:~/local/lib/perl5/site_perl:~/local/lib/perl5/site_perl/5.18.2:~/local/lib/perl5/site_perl/5.18.2/x86_64-linux:~/local/lib/perl5/5.18.2/x86_64-linux:/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi:/usr/lib/perl5/site_perl/5.8.8:/usr/lib/perl5/site_perl:/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi:/usr/lib/perl5/vendor_perl/5.8.8:/usr/lib/perl5/vendor_perl:/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi:/usr/lib/perl5/5.8.8
115 113
 
116 114
 # Python
117
-python_version=$(python --version 2>&1 | cut -d " " -f2 | cut -d "." -f -2)
118
-export PYTHONPATH=$HOME/local/lib/python${python_version}/site-packages
119 115
 export PYTHONIOENCODING=utf-8
120
-unset python_version
121 116
 
122 117
 
123 118
 #----------#
... ...
@@ -133,20 +128,12 @@ export CONSED_HOME=~/local/bin/consed.d
133 128
 # Vim
134 129
 export VIMHOME=$HOME/.vim
135 130
 
136
-# R
137
-R_version=$(R --version | head -1 | cut -d " " -f 3)
138
-export R_LIBS_HOME="$HOME/.R-libs"
139
-
140
-if [[ ! -d "${R_LIBS_HOME}/${R_version}" ]]
141
-then
142
-    mkdir "${R_LIBS_HOME}/${R_version}"
143
-fi
144
-
145
-export R_LIBS="${R_LIBS_HOME}/${R_version}"
146
-
131
+# Miniconda
132
+[[ -d "$HOME/.miniconda3" ]] && source "$HOME/.miniconda3/etc/profile.d/conda.sh"
133
+[[ -n $CONDA_DEFAULT_ENV ]]  && conda activate $CONDA_DEFAULT_ENV
147 134
 
148 135
 # OPAM completion
149
-source $HOME/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
136
+[[ $SHLVL -eq 1 ]] && source $HOME/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
150 137
 
151 138
 # Git completion
152 139
 [[ -s "/etc/bash_completion.d/git" ]] && source /etc/bash_completion.d/git
... ...
@@ -154,6 +141,9 @@ source $HOME/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
154 141
 # Biom completion
155 142
 [[ $(which biom &> /dev/null ; echo $?) == 0 ]] && eval "$(_BIOM_COMPLETE=source biom)"
156 143
 
144
+# Linuxbrew completion
145
+[[ -s "$HOME/.linuxbrew/etc/bash_completion.d/brew" ]] && source "$HOME/.linuxbrew/etc/bash_completion.d/brew"
146
+
157 147
 
158 148
 # SSH environment setup
159 149
 SSH_KEY_LIST="$HOME/.ssh/key_list"  # File with full path of keys (one per line) to load with start_agent