detect redhat
[zsh.git] / .zsh / zshenv
1 # -*- mode: sh;-*-
2 ############
3 #
4 # .zshenv
5 # Written by Joerg Jaspert <joerg@debian.org>
6 #
7 ############
8
9 # We (may) use those variables wherever, so fill them now.
10 # Avoids calling the processes all the time we need em.
11 OSNAME=`uname -s`
12 USER=${USER:-`whoami`}
13 UID=${UID:-`id -u`}
14 # :r strips "extension" (a . followed by 0 or more characters)
15 HOST=$HOST:r:r
16 HOST=${HOST:-$(hostname -s)}
17 DOMAIN=${DOMAIN:-$(hostname -d 2>&-)}
18 [ "$DOMAIN" = "" -o "$DOMAIN" = "localdomain" -o "$DOMAIN" = "(none)" ] && DOMAIN=$(grep "^search " /etc/resolv.conf | cut -d' ' -f2)
19 [[ -f /etc/debian_version ]] && DISTRI="Debian"
20 [[ -f /etc/redhat-release ]] && DISTRI="RedHat"
21
22 # Local settings and styles can go here and (usually) overwrite
23 # things defined by me later.
24 [[ -f ${ZDOTDIR}/zshenv.local ]] && source ${ZDOTDIR}/zshenv.local
25
26 DEBUG=${DEBUG:-no}
27
28 # Path to search for autoloadable functions.
29 fpath=( ${ZDOTDIR}/functions "$fpath[@]" )
30 # Only unique entries please.
31 typeset -U fpath
32 fpath=( ${^fpath}(N-/) )
33 export fpath
34
35 # Include function path in script path so that we can run them even
36 # though a subshell may not know about functions.
37 # PATH should already be exported, but in case not. . .
38 path=(
39 "$lpath[@]"
40 /usr/local/bin
41 /bin
42 /usr/bin
43 /usr/X11/bin
44 /usr/bin/X11
45 /usr/local/X11/bin
46 /usr/local/games
47 /usr/games
48 /usr/lib/nagios/plugins
49 "$fpath[@]"
50 "$path[@]"
51 "$PATH[@]"
52 )
53 if [ "`id -u`" = "0" ] || ! [ -x /usr/bin/id ]; then
54 path=(
55 "$path[@]"
56 /usr/local/sbin
57 /usr/sbin
58 /sbin
59 )
60 fi
61
62 manpath=(
63 "$lmanpath[@]"
64 /usr/share/man
65 /usr/local/share/man
66 "$manpath[@]"
67 )
68
69 # Only unique entries please.
70 typeset -gU path
71 typeset -gU manpath
72
73 # Remove entries that don't exist on this system. Just for sanity's
74 # sake more than anything.
75 path=( ${^path}(N-/) )
76 manpath=( ${^manpath}(N-/) )
77
78 # Command to use when redirecting from/to a null command.
79 # READNULLCMD is redefined in .zshrc for interactive shells.
80 READNULLCMD=cat
81 NULLCMD=cat
82
83 # Unix groups: remember the original group ID. (For prompts.)
84 if [[ ${+ORIGGID} -eq 0 ]]; then
85 export ORIGGID="$GID"
86 fi
87
88 # Just to make damn sure they are there.
89 export PATH USER HOST DOMAIN UID OSNAME DISTRI