-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.jr_rc
More file actions
64 lines (54 loc) · 1.26 KB
/
Copy path.jr_rc
File metadata and controls
64 lines (54 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
rejr() {
. ~/.jr_rc
echo jrrc reload ok
}
env_for_compile() {
prepend_PATH dart/depot_tools
append_PATH ~/pre/bin/
export HTTP_PROXY=127.0.0.1:7890
}
prepend_PATH() {
readarray -td: pathArray <<<"$PATH"
# echo appending $1 onto ${pathArray[0]}
if [ "$1" == "${pathArray[0]}" ] ; then
echo env PATH untouched
else
export PATH=$1:$PATH
echo env PATH touched
fi
}
hdrop_PATH() {
readarray -td: pathArray <<<"$PATH"
# echo appending $1 onto ${pathArray[0]}
if [ "" == "${pathArray[0]}" ] ; then
echo env PATH untouched
else
echo droping ${pathArray[0]} in head PATH
unset pathArray[0]
export PATH=$(export IFS=':' ;echo "${pathArray[*]}")
fi
}
append_PATH() {
readarray -td: pathArray <<<"$PATH"
# echo appending $1 onto ${pathArray[0]}
if [ '$1' == '${pathArray[-1]}' ] ; then
echo env PATH untouched
else
export PATH=$PATH:$1
echo env PATH touched
fi
}
tdrop_PATH() {
readarray -td: pathArray <<<"$PATH"
# echo appending $1 onto ${pathArray[0]}
if [ '' == '${pathArray[-1]}' ] ; then
echo env PATH untouched
else
echo droping ${pathArray[0]} in tail PATH
unset pathArray[-1]
export PATH=$(export IFS=':' ;echo "${pathArray[*]}")
fi
}
path() {
echo $PATH
}