-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.environment_bash
More file actions
executable file
·119 lines (100 loc) · 3.35 KB
/
.environment_bash
File metadata and controls
executable file
·119 lines (100 loc) · 3.35 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
# .environment_bash
# Ver v4.3 20170912 zot u1404 + vm
# 4.3 add paths for brew coreutils, mac X11 (opt)
# 4.2 make non-interactive exit rather than return
# 4.1 change variable setting to -v
# add REM_HOST
# echo "*** environment_bash ***"
if [[ -v ENV_SET ]]; then
if [[ -v PS1 ]]; then return 0; fi
exit 0;
fi
export BIN_ARCH CDPATH CLASSPATH
export ENV_SET EXINIT HOST INFOPATH
export MANPATH USER
export TEXINPUTS BSTINPUTS BIBINPUTS
#
# if in via SSH, X pass through, Linux, and pidof available,
# find a DBUS_SESSION so we can start X programs and have them
# work.
#
gs_pid=
if [ -x /bin/pidof ]; then
gs_pid=$(pidof gnome-session)
fi
if [[ -x /bin/pidof && ! -n $gs_pid ]]; then
gs_pid=$(pidof x-session-manager)
fi
if [[ -n ${gs_pid} && -n ${SSH_CLIENT} && "x${OSNAME}" == "xLinux" ]]; then
[[ -z ${SSH_AUTH_SOCK} ]] && export SSH_AUTH_SOCK=`cat /proc/$gs_pid/environ | tr '\0' '\n' | grep SSH_AUTH_SOCK | cut -d '=' -f2-`
[[ -z ${DBUS_SESSION_BUS_ADDRESS} ]] && export DBUS_SESSION_BUS_ADDRESS=`cat /proc/$gs_pid/environ | tr '\0' '\n' | grep DBUS_SESSION_BUS_ADDRESS | cut -d '=' -f2-`
# [[ -z ${XAUTHORITY} ]] && export XAUTHORITY=`cat /proc/$gs_pid/environ | tr '\0' '\n' | grep XAUTHORITY | cut -d '=' -f2-`
fi
# if host hasn't already been set, set it to the host (w/o domain)
if [[ ! -v HOST ]] ; then
if [ -x /bin/hostname ]; then # Linux/HP-UX/sunos4.x boxes
hostnamecmd=/bin/hostname
else
hostnamecmd="uname -n" # nodename
fi
fi
HOST=${HOST:-`$hostnamecmd | sed -e 's/\\..*//'`}
unset hostnamecmd
if [[ ! -v REM_HOST ]]; then
if [[ -v SSH_CLIENT ]]; then
REM_HOST=`dig +short -x ${SSH_CLIENT%% *} | cut -d"." -f1`
fi
fi
if [[ ! -v USER ]]; then
USER=`id | sed -e 's/[^=]*=[0-9]*(\([^)]*\).*/\1/'`
fi
if [[ -x /bin/arch || -x /usr/bin/arch ]] ; then
BIN_ARCH=${BIN_ARCH:-`arch`}
fi
pathset() {
while [ $# -gt 0 -a ! -d "$1" ]; do shift ; done
if [ $# -gt 0 ]; then
if [ -d $1 ]; then t=$1; shift; fi
for d in $*; do if [ -d $d ]; then t=$t:$d; fi; done
fi
echo $t
unset d t
}
pathappend() {
t=$1; shift; for d in $*; do if [ -d $d ]; then t=$t:$d; fi; done
echo $t
unset d t
}
pathprefix() {
t=$1; shift; for d in $*; do if [ -d $d ]; then t=$t:$d; fi; done
echo $t
unset d t
}
PATH=`pathset $HOME/.bin/mspgcc/bin $HOME/.bin \
/usr/gcc-arm-none-eabi-4_9-2015q3/bin \
/usr/local/opt/coreutils/libexec/gnubin \
/opt/X11/bin \
/usr/local/bin /usr/local/sbin \
/usr/bin /usr/sbin /bin /sbin `
MANPATH=`pathset \
/usr/gcc-arm-none-eabi-4_9-2015q3/share/doc/gcc-arm-none-eabi/man \
/usr/local/opt/coreutils/libexec/gnuman \
/opt/X11/share/man \
/usr/local/man /usr/local/share/man \
/usr/man /usr/share/man `
INFOPATH=`pathset ~/.emacs.d/info \
/usr/gcc-arm-none-eabi-4_9-2015q3/share/doc/gcc-arm-none-eabi/info \
/usr/local/info /usr/local/share/info \
/usr/info /usr/share/info `
export CDPATH=.:..:$HOME
export EXINIT='set aw ai ic nows sm' # set vi (ex) options
export XENVIRONMENT='~/.Xdefaults'
if [ -x /usr/bin/less ]; then
export PAGER=${PAGER:-/usr/bin/less}
fi
export RSYNC_RSH=ssh
# ensure that we don't need to reset the environment for any sub-shells
unset addsw addswman
if [ -r ~/.environment_bash.local ]; then . ~/.environment_bash.local; fi
ENV_SET=true