# /etc/profile # $Id$ # System wide environment and startup programs # Functions and aliases go into the shells dependent startup files # returns TRUE if $1 contains $2 strstr() { [[ $1 = *$2* ]] && return 0 || return 1 } strstr "$PATH" /usr/X11R6/bin || PATH="$PATH:/usr/X11R6/bin" strstr "$PATH" /usr/local/bin || PATH="$PATH:/usr/local/bin" strstr "$PATH" "$HOME/bin" || PATH="$PATH:$HOME/bin" unset strstr USER=`id -un` LOGNAME=$USER HOSTNAME=`/bin/uname -n` HISTFILE="$HOME/.history" HISTSIZE=1000 if [ "`id -gn`" = $USER -a `id -u` -gt 14 ]; then umask 002 else umask 022 fi # # Setup the environment for various shells # if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then TERM=linux fi SH="${0#\-}" SH="${SH#/bin/}" if [ "$SH" = "sh" ]; then if [ -n "$KSH_VERSION" ]; then SH=ksh elif [ -n "$ZSH_VERSION" ]; then SH=zsh elif [ -n "$BASH_VERSION" ]; then SH=bash elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then SH=ksh93 fi fi case "$SH" in bash) # currently - nothing ;; ksh|pdksh) PS2='> ' set -o emacs bind '^I'=complete >/dev/null 2>&1 bind '^[^I'=complete-list >/dev/null 2>&1 # # Setup some of the most basic editing functions # to work properly under different terminal emulators. # case $TERM in nxterm|xterm|xterm-color) bind '^[[H'=beginning-of-line >/dev/null 2>&1 bind '^[[F'=end-of-line >/dev/null 2>&1 ;; linux|rxvt) bind '^[[1~'=beginning-of-line >/dev/null 2>&1 bind '^[[4~'=end-of-line >/dev/null 2>&1 ;; esac ;; ksh93) if [ `id -u` -eq 0 ]; then PS1='[${LOGNAME-$USER}@${HOSTNAME} ` if [ "$PWD" = "/${PWD##*/}" ]; then echo $PWD; else echo ${PWD##*/}; fi`]# ' else PS1='[${LOGNAME-$USER}@${HOSTNAME} ` if [ "$PWD" = "/${PWD##*/}" ]; then echo $PWD; else echo ${PWD##*/}; fi`]$ ' fi PS2='> ' set -o nolog set -o emacs case $TERM in nxterm|xterm|xterm-color) trap 'case ${.sh.edchar} in "") .sh.edchar="" ;; "") .sh.edchar="" ;; esac' KEYBD ;; linux|rxvt) trap 'case ${.sh.edchar} in "[4~") .sh.edchar="" ;; "[1~") .sh.edchar="" ;; esac' KEYBD ;; esac ;; zsh) # other HISTFILE, zsh uses diffrent fmt HISTFILE=~/.historyz # w/o this hist file won't get saved! SAVEHIST=$HISTSIZE ;; esac unset SH export PATH USER LOGNAME HOSTNAME HISTFILE HISTSIZE PS1 PS2 # Put all of the variables as files in /etc/env.d/ # example: # cat /etc/env.d/VARIABLE # VARIABLE="value" if [ -f /etc/profile.env ]; then . /etc/profile.env else for i in /etc/env.d/* ; do NAME=${i##*/} case $NAME in *~ | *.bak | *.old | *.rpmnew | *.rpmsave ) # nothing ;; * ) if [ -r $i ]; then . $i; export $NAME fi ;; esac done unset NAME fi # Scripts: for i in /etc/profile.d/*.sh ; do . $i done unset i # vi:syntax=sh