-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate
62 lines (51 loc) · 1.58 KB
/
template
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
# This file must be loaded using pathify (or sourced from bash)
# You cannot run it directly
#
# Environment generated from pathify template
#
# <Add your desciption here>
deactivate_@env@ () {
# begin unload variables
if [ -n "${_OLD_@ENV@_PATH+set}" ] ; then
export PATH="$_OLD_@ENV@_PATH"
unset _OLD_@ENV@_PATH
fi
# end unload variables
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" ] || [ -n "$ZSH_VERSION" ] ; then
hash -r
fi
if [ -n "$_OLD_@ENV@_PS1" ] ; then
PS1="$_OLD_@ENV@_PS1"
export PS1
unset _OLD_@ENV@_PS1
fi
unset @ENV@_ENV
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate_@env@
fi
}
# unset irrelavent variables
deactivate_@env@ nondestructive
@ENV@_ENV="@env@"
export @ENV@_ENV
# begin load variables
_OLD_@ENV@_PATH="$PATH"
export PATH="/sbin:$PATH"
# end load variables
if [ -z "$@ENV@_ENV_DISABLE_PROMPT" ] &&
[ -z "$PATHIFY_DISABLE_PROMPT" ] ; then
_OLD_@ENV@_PS1="$PS1"
# Add env name before first non-whitespace PS1 char
PS1=$(echo "$PS1" | sed -e '0,/\S/s//[@env@] &/')
export PS1
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r
fi