comparison .bash_overrides @ 0:f3ab51c79813

adding configuration from https://svn.openplans.org/svn/config_jhammel/
author k0s <k0scist@gmail.com>
date Thu, 15 Oct 2009 11:41:26 -0400
parents
children f890a12d8cf5
comparison
equal deleted inserted replaced
-1:000000000000 0:f3ab51c79813
1 #!/bin/bash
2
3 function unlink {
4 command unlink `echo $@ | sed 's/\/$//g'`
5 }
6
7 function find {
8
9 if (( ! $# ))
10 then
11 return
12 fi
13
14 if [ -d $1 ]
15 then
16 DIR="$1"
17 shift
18 else
19 DIR="$PWD"
20 fi
21
22 if [ "$#" == "1" ]
23 then
24 `which find` -L "$PWD" -not -path '*.svn*' -iname "$1"
25 return 0
26 fi
27
28 COMMAND="`which find` -L \"$DIR\" -not -path '*.svn*' $@"
29 #echo $COMMAND # for debugging
30 `which find` -L "$DIR" -not -path '*.svn*' "$@"
31 }
32
33 cd() {
34
35 ENV=""
36 # find if you're in a
37 if [ -n "${WORKING_ENV}" ]
38 then
39 ENV="${WORKING_ENV}"
40 fi
41 if [ -n "${VIRTUAL_ENV}" ]
42 then
43 ENV="${VIRTUAL_ENV}"
44 fi
45
46
47 if [ -d "$@" ]
48 then
49 command cd "$@"
50 else
51 if [ -e "$@" ]
52 then
53 command cd `dirname "$@"`
54 else
55 if [[ "$@" == "^" && -n "${ENV}" ]]
56 then
57 command cd "${ENV}"
58 else
59 command cd "$@"
60 fi
61 fi
62 fi
63
64 # handle ENVs
65 if [ -e "bin/activate" ]
66 then
67 if [ -n "${ENV}" ]
68 then
69 if [ "${ENV}" != "${PWD}" ]
70 then
71 if [[ -n "`type -t deactivate`" ]]
72 then
73 deactivate
74 fi
75 else
76 return
77 fi
78 fi
79 source "bin/activate"
80 fi
81
82 ENV=""
83 # find if you're in a
84 if [ -n "${WORKING_ENV}" ]
85 then
86 ENV="${WORKING_ENV}"
87 fi
88 if [ -n "${VIRTUAL_ENV}" ]
89 then
90 ENV="${VIRTUAL_ENV}"
91 fi
92
93 if [ -n "${ENV}" ]
94 then
95 FULLPWD=$(python -c 'import os; print os.getcwd()')
96 if (( ! `expr match "${FULLPWD}" "${ENV}"` ))
97 then
98 if [[ -n "`type -t deactivate`" ]]
99 then
100 deactivate
101 fi
102 fi
103 fi
104 unset ENV
105 }
106
107 emacsclient() {
108 command emacsclient $@ > /dev/null &
109 }