| ... | ... |
@@ -1,8 +1,8 @@ |
| 1 | 1 |
# Title: .bashrc |
| 2 | 2 |
# Author: Frédéric CHEVALIER <f15.chevalier@gmail.com> |
| 3 |
-# Version: 1.4 |
|
| 3 |
+# Version: 1.5 |
|
| 4 | 4 |
# Created in: 2012-05-26 |
| 5 |
-# Modified in: 2014-07-26 |
|
| 5 |
+# Modified in: 2014-08-06 |
|
| 6 | 6 |
|
| 7 | 7 |
|
| 8 | 8 |
|
| ... | ... |
@@ -19,6 +19,7 @@ |
| 19 | 19 |
# Versions # |
| 20 | 20 |
#==========# |
| 21 | 21 |
|
| 22 |
+# v1.5 - 2014-08-06: autocd set on / R alias added / bk function turned in a separate script / SSH environment setup moved in bash_profile |
|
| 22 | 23 |
# v1.4 - 2014-07-26: ssh_agent function for SSH key management added / ssh_agent called when used SSH connexion / wf alias updated |
| 23 | 24 |
# v1.3 - 2014-07-19: bug correction for PS1 (\[\e and \] missing for each color) / typo corrections |
| 24 | 25 |
# v1.2 - 2014-07-06: h and t aliases corrected / m alias added / quit function added / R env variables added |
| ... | ... |
@@ -87,7 +88,7 @@ shopt -s checkwinsize |
| 87 | 88 |
shopt -s cdspell |
| 88 | 89 |
|
| 89 | 90 |
# Avoid cd usage |
| 90 |
-#shopt -s autocd |
|
| 91 |
+shopt -s autocd |
|
| 91 | 92 |
|
| 92 | 93 |
# Make less more friendly for non-text input files, see lesspipe(1) |
| 93 | 94 |
[[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)" |
| ... | ... |
@@ -204,6 +205,7 @@ alias h="head" |
| 204 | 205 |
alias t="tail" |
| 205 | 206 |
alias m="more" |
| 206 | 207 |
alias bye="exit" |
| 208 |
+alias R="R --no-save" |
|
| 207 | 209 |
|
| 208 | 210 |
|
| 209 | 211 |
# You may want to put all your additions into a separate file like |
| ... | ... |
@@ -315,18 +317,6 @@ else |
| 315 | 317 |
fi |
| 316 | 318 |
|
| 317 | 319 |
|
| 318 |
-# Backup function |
|
| 319 |
-function bk {
|
|
| 320 |
- if [[ -f "$1" || -d "$1" ]] |
|
| 321 |
- then |
|
| 322 |
- mydate=$(date +%F) |
|
| 323 |
- cp -R "$1" "$1.bk_$mydate" |
|
| 324 |
- else |
|
| 325 |
- echo -e "$1 is not a file or a directory" |
|
| 326 |
- fi |
|
| 327 |
-} |
|
| 328 |
- |
|
| 329 |
- |
|
| 330 | 320 |
# Quit function |
| 331 | 321 |
function q {
|
| 332 | 322 |
read -a ans -p "Do you want to exit [Y/n]? " |
| ... | ... |
@@ -342,6 +332,8 @@ function q {
|
| 342 | 332 |
|
| 343 | 333 |
|
| 344 | 334 |
# SSH agent function |
| 335 |
+# Usage: function used to store SSH environment (SSH key in ssh-agent) |
|
| 336 |
+# See .bash_profile from servers for use |
|
| 345 | 337 |
function start_agent {
|
| 346 | 338 |
if [[ $LANG =~ ^fr ]] |
| 347 | 339 |
then |
| ... | ... |
@@ -392,17 +384,5 @@ export R_HISTSIZE=$HISTSIZE |
| 392 | 384 |
|
| 393 | 385 |
|
| 394 | 386 |
# SSH environment |
| 395 |
-SSH_ENV="$HOME/.ssh/ssh_agent_$HOSTNAME" |
|
| 387 |
+export SSH_ENV="$HOME/.ssh/ssh_agent_$HOSTNAME" |
|
| 396 | 388 |
|
| 397 |
-if [[ -n "$SSH_CONNECTION" ]] |
|
| 398 |
-then |
|
| 399 |
- # Source SSH settings, if applicable |
|
| 400 |
- if [[ -f "${SSH_ENV}" ]]
|
|
| 401 |
- then |
|
| 402 |
- source "${SSH_ENV}" > /dev/null
|
|
| 403 |
- #ps ${SSH_AGENT_PID} doesn't work under cywgin
|
|
| 404 |
- ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || start_agent
|
|
| 405 |
- else |
|
| 406 |
- start_agent |
|
| 407 |
- fi |
|
| 408 |
-fi |
|
| 409 | 389 |
\ No newline at end of file |
| ... | ... |
@@ -1,14 +1,15 @@ |
| 1 | 1 |
# Title: .bash_profile |
| 2 | 2 |
# Author: Frédéric CHEVALIER <f15.chevalier@gmail.com> |
| 3 |
-# Version: 1.2 |
|
| 3 |
+# Version: 1.3 |
|
| 4 | 4 |
# Created in: 2012-05-25 |
| 5 |
-# Modified in: 2014-07-09 |
|
| 5 |
+# Modified in: 2014-08-06 |
|
| 6 | 6 |
|
| 7 | 7 |
|
| 8 | 8 |
#==========# |
| 9 | 9 |
# Versions # |
| 10 | 10 |
#==========# |
| 11 | 11 |
|
| 12 |
+# v1.3 - 2014-08-06: part for SSH environment setup moved from .bashrc to avoid setting up SSH environment when connection to a node (qrsh) |
|
| 12 | 13 |
# v1.2 - 2014-07-09: behaviour modified when login to a node using qrsh (qrsh alias modified / if loop correction for message) |
| 13 | 14 |
# v1.1 - 2014-07-01: specific aliases needed for GridEngine added |
| 14 | 15 |
# v1.0 - 2014-06-28: rewriting for better interplay with .bashrc |
| ... | ... |
@@ -88,6 +89,24 @@ fi |
| 88 | 89 |
export R_LIBS="${R_LIBS_HOME}/${R_version}"
|
| 89 | 90 |
|
| 90 | 91 |
|
| 92 |
+# SSH environment setup |
|
| 93 |
+if [[ ! $HOSTNAME =~ compute.* ]] |
|
| 94 |
+then |
|
| 95 |
+ if [[ -n "$SSH_CONNECTION" ]] |
|
| 96 |
+ then |
|
| 97 |
+ # Source SSH settings, if applicable |
|
| 98 |
+ if [[ -f "${SSH_ENV}" ]]
|
|
| 99 |
+ then |
|
| 100 |
+ source "${SSH_ENV}" > /dev/null
|
|
| 101 |
+ #ps ${SSH_AGENT_PID} doesn't work under cywgin
|
|
| 102 |
+ ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || start_agent
|
|
| 103 |
+ else |
|
| 104 |
+ start_agent |
|
| 105 |
+ fi |
|
| 106 |
+ fi |
|
| 107 |
+fi |
|
| 108 |
+ |
|
| 109 |
+ |
|
| 91 | 110 |
|
| 92 | 111 |
#=================# |
| 93 | 112 |
# Welcome message # |