Browse code

bashrc - v1.1 - see Versions section for details

Fred authored on02/07/2014 16:32:48
Showing1 changed files
... ...
@@ -1,8 +1,8 @@
1 1
 # Title: .bashrc
2 2
 # Author: Frédéric CHEVALIER <f15.chevalier@gmail.com>
3
-# Version: 1.0
4
-# Created in: 2014-06-22
5
-# Modified in:
3
+# Version: 1.1
4
+# Created in: 2012-05-26
5
+# Modified in: 2014-07-02
6 6
 
7 7
 
8 8
 
... ...
@@ -20,8 +20,9 @@
20 20
 # Versions #
21 21
 #==========#
22 22
 
23
-# v1.0: file reorganization / aliases added
24
-# v0.0: creation
23
+# v1.1 - 2014-07-02: bug corrections in trash function and EDITOR set up / exit and diff aliases added
24
+# v1.0 - 2014-06-22: file reorganization / aliases added
25
+# v0.0 - 2012-05-26: creation
25 26
 
26 27
 
27 28
 
... ...
@@ -164,15 +165,15 @@ if [ -x /usr/bin/dircolors ]
164 165
 then
165 166
     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
166 167
 
167
-    alias ls='ls --color=auto --group-directories-first -h -C'
168
-    alias dir='dir --color=auto'
169
-    alias vdir='vdir --color=auto'
168
+    alias ls="ls --color=auto --group-directories-first -h -C"
169
+    alias dir="dir --color=auto"
170
+    alias vdir="vdir --color=auto"
170 171
 
171
-    alias grep='grep --color=auto'
172
-    alias fgrep='fgrep --color=auto'
173
-    alias egrep='egrep --color=auto'
172
+    alias grep="grep --color=auto"
173
+    alias fgrep="fgrep --color=auto"
174
+    alias egrep="egrep --color=auto"
174 175
 
175
-    alias tree='tree -C'
176
+    alias tree="tree -C"
176 177
 fi
177 178
 
178 179
 
... ...
@@ -181,30 +182,32 @@ fi
181 182
 # User specific aliases #
182 183
 #=======================#
183 184
 
185
+# Moving in directories
186
+alias ..="cd .."
187
+alias ....="cd ../.."
188
+
184 189
 # Listing files
185 190
 alias l="ls"
186
-alias ll="ls -l"
191
+alias ll="l -l"
187 192
 alias lr="l --recursive"
188 193
 alias llr="ll --recursive"
189 194
 alias la="ls -A"
190 195
 alias lla="la -l"
191 196
 
192
-# Moving in directories
193
-alias ..='cd ..'
194
-alias ....='cd ../..'
197
+# File manipulations
198
+alias diff="diff -y --suppress-common-lines"
195 199
 
196 200
 # Internet
197 201
 alias dl="wget -c"
198
-alias scp='scp -pr'
199
-alias ssh='ssh -Y'
200
-alias wf='ssh wf@vaderf.com'
201
-alias wf2='ssh wf2@192.168.1.65'
202
-alias fwf='ssh fred@vaderf.com'
203
-alias heron='ssh fcheval@heron.txbiomedgenetics.org'
202
+alias scp="scp -pr"
203
+alias ssh="ssh -Y"
204
+alias wf="ssh wf@vaderf.com"
205
+alias fwf="ssh fred@vaderf.com"
206
+alias heron="ssh fcheval@heron.txbiomedgenetics.org"
204 207
 
205 208
 # Disk space
206
-alias df='df -h'
207
-alias du='du -h'
209
+alias df="df -h"
210
+alias du="du -h"
208 211
 
209 212
 # Safety aliases
210 213
 #alias rm="rm --interactive"
... ...
@@ -214,6 +217,7 @@ alias c="cat"
214 217
 alias g="grep"
215 218
 alias h="head -15"
216 219
 alias t="tail -15"
220
+alias bye="exit"
217 221
 
218 222
 
219 223
 # You may want to put all your additions into a separate file like
... ...
@@ -311,20 +315,19 @@ function extract {
311 315
 
312 316
 
313 317
 # Trash function
314
-function trash {
315
-	# Check if trash-cli is installed otherwize check for already existing .trash
316
-	if [[ $(which trash-put) ]]
318
+# Check if trash-cli is installed otherwize check for already existing .trash
319
+if [[ $(which trash-put &> /dev/null ; echo $?) == 0 ]]
320
+then
321
+	alias trash='trash-put'
322
+else
323
+	if [[ -d $HOME/.trash/ ]]
317 324
 	then
318
-		alias trash='trash-put'
325
+		alias trash='mv $1 -t $HOME/.trash/'
319 326
 	else
320
-		if [[ -d $HOME/.trash/ ]]
321
-		then
322
-			alias trash='mv $1 -t $HOME/.trash/'
323
-		else
324
-			echo -e "\n\tNo trash set up: trash-cli not installed or $HOME/.trash/ does not exist.\n"
325
-		fi
327
+		echo -e "\n\tNo trash set up: trash-cli not installed or $HOME/.trash/ does not exist.\n"
326 328
 	fi
327
-}
329
+fi
330
+
328 331
 
329 332
 
330 333
 # Backup function
... ...
@@ -345,7 +348,7 @@ function bk {
345 348
 #================================================#
346 349
 
347 350
 # Editor
348
-if [[ $(which vim) ]]
351
+if [[ $(which vim &> /dev/null ; echo $?) == 0 ]]
349 352
 then
350 353
 	export EDITOR="vim"
351 354
 else
... ...
@@ -358,4 +361,4 @@ export PATH="$HOME/.local/bin:$PATH"
358 361
 
359 362
 
360 363
 # LaTeX environment
361
-export TEXMFHOME=$HOME/.texmf
362 364
\ No newline at end of file
365
+export TEXMFHOME=$HOME/.texmf