[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

environment variables



Just curious about the best way to manage env var's.  I edited /etc/
profile which works fine, but what happens when a new version of java 
gets installed?


[makerpm arrakis ~]$ 
[makerpm arrakis ~]$ 
[makerpm arrakis ~]$ cat /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc


JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/


pathmunge () {
	if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
	   if [ "$2" = "after" ] ; then
	      PATH=$PATH:$1
	   else
	      PATH=$1:$PATH
	   fi
	fi
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then 
	EUID=`id -u`
	UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
	pathmunge /sbin
	pathmunge /usr/sbin
	pathmunge /usr/local/sbin
else
	pathmunge /usr/local/sbin after
	pathmunge /usr/sbin after
	pathmunge /sbin after
fi

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

if [ -x /usr/bin/id ]; then
	USER="`id -un`"
	LOGNAME=$USER
	MAIL="/var/spool/mail/$USER"
fi

HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE JAVA_HOME

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "$PS1" ]; then
            . $i
        else
            . $i >/dev/null 2>&1
        fi
    fi
done

export PATH

unset i
unset pathmunge
[makerpm arrakis ~]$ 
[makerpm arrakis ~]$ env
ORBIT_SOCKETDIR=/tmp/orbit-thufir
HOSTNAME=arrakis
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=32a9bfc77b4a195b688875bf4a1883ed-1243842275.899648-1364835814
HISTSIZE=1000
GTK_RC_FILES=/etc/gtk/gtkrc:/home/thufir/.gtkrc-1.2-gnome2
WINDOWID=16779001
QTDIR=/usr/lib/qt-3.3
QTINC=/usr/lib/qt-3.3/include
USER=makerpm
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:do=00;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=00;32:*.tar=00;31:*.tgz=00;31:*.svgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.dz=00;31:*.gz=00;31:*.bz2=00;31:*.tbz2=00;31:*.bz=00;31:*.tz=00;31:*.deb=00;31:*.rpm=00;31:*.jar=00;31:*.rar=00;31:*.ace=00;31:*.zoo=00;31:*.cpio=00;31:*.7z=00;31:*.rz=00;31:*.jpg=00;35:*.jpeg=00;35:*.gif=00;35:*.bmp=00;35:*.pbm=00;35:*.pgm=00;35:*.ppm=00;35:*.tga=00;35:*.xbm=00;35:*.xpm=00;35:*.tif=00;35:*.tiff=00;35:*.png=00;35:*.mng=00;35:*.pcx=00;35:*.mov=00;35:*.mpg=00;35:*.mpeg=00;35:*.m2v=00;35:*.mkv=00;35:*.ogm=00;35:*.mp4=00;35:*.m4v=00;35:*.mp4v=00;35:*.vob=00;35:*.qt=00;35:*.nuv=00;35:*.wmv=00;35:*.asf=00;35:*.rm=00;35:*.rmvb=00;35:*.flc=00;35:*.avi=00;35:*.fli=00;35:*.gl=00;35:*.dl=00;35:*.xcf=00;35:*.xwd=00;35:*.yuv=00;35:*.svg=00;35:*.aac=00;36:*.au=00;36:*.flac=00;!
 36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:
SSH_AUTH_SOCK=/tmp/keyring-RPy3db/ssh
GNOME_KEYRING_SOCKET=/tmp/keyring-RPy3db/socket
USERNAME=thufir
SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/17658,unix/unix:/tmp/.ICE-
unix/17658
DESKTOP_SESSION=gnome
PATH=/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/
bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/thufir/bin
MAIL=/var/spool/mail/thufir
PWD=/home/makerpm
XMODIFIERS= im=imsettings
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/
KDE_IS_PRELINKED=1
GNOME_KEYRING_PID=17655
LANG=en_US.UTF-8
GDM_LANG=en_US.UTF-8
KDEDIRS=/usr
GDMSESSION=gnome
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HOME=/home/makerpm
SHLVL=3
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=makerpm
CVS_RSH=ssh
QTLIB=/usr/lib/qt-3.3/lib
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-
swOenhod2G,guid=437d13456e1c52677517147e4a2386e4
LESSOPEN=|/usr/bin/lesspipe.sh %s
DISPLAY=:0.0
QT_PLUGIN_PATH=/home/thufir/.kde/lib/kde4/plugins/:/usr/lib/kde4/
plugins/:/home/makerpm/.kde/lib/kde4/plugins/:/usr/lib/kde4/plugins/
G_BROKEN_FILENAMES=1
XAUTHORITY=/home/makerpm/.xauthqUCqV7
COLORTERM=gnome-terminal
_=/usr/bin/env
OLDPWD=/home/thufir
[makerpm arrakis ~]$ 
[makerpm arrakis ~]$ 





-Thufir


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]