PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
unset DOSDRIVE
unset DOSDIR
unset TMPDIR
unset TMP

umask 022

USER="`id -un`"

# Set up USER's home directory
if [ -z "$HOME" ]; then
  HOME="/home/$USER"
fi

if [ ! -d "$HOME" ]; then
  mkdir -p "$HOME"
fi

if [ -d "$HOME/bin" ]; then
  PATH="$HOME/bin:$PATH"
fi

export HOME USER

#mwe: set a HOSTNAME variable to the host name in lower case letters
export HOSTNAME=`hostname|tr '[A-Z]' '[a-z]'`

for i in /etc/profile.d/*.sh ; do
  if [ -f $i ]; then
    . $i
  fi
done

# see: http://www.ibb.net/~anne/keyboard/keyboard.html#Bash
if tty --quiet ; then
        stty erase '^?'
fi

#mwe: create a .inputrc file that allows for case insensitive file/directory
#mwe: completion and some more stuff
if [ ! -e "/etc/inputrc" ]; then
 cat  > /etc/inputrc << ENDENDEND
# /etc/inputrc
# This file is read by the 'readline' library
# (the library which bash uses for its command-
# line editing facility)

"\e[3~": delete-char
# this is actually equivalent to "\C-?": delete-char
# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H": beginning-of-line
"\e[F": end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~": beginning-of-line
"\e[8~": end-of-line

# Make Insert work
"\e[2~": paste-from-clipboard

# Ignore case for the command-line-completion
# functionality.
#set completion-ignore-case On

set meta-flag On
set convert-meta Off
set output-meta On

# END of .inputrc
ENDENDEND
  chmod 644 /etc/inputrc
fi

export INPUTRC=/etc/inputrc
export TERMINFO=/usr/share/terminfo
export CVSROOT=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/src
export TEMP=/tmp

export MAKE_MODE=unix

#mwe: There may be cases when you log on using ASH (/bin/sh) rather than BASH.
#     in this case, you'll have to set up the prompt and lack of aliases
#     differently.
if [ ! -z "$BASH" ]; then
  #mwe: set the prompt to include [user@host], current working directory,
  #     {history number} and either $ or #.
  export PS1='\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
  cd $HOME
  test -f ./.bashrc && . ./.bashrc

  #mwe: if aliases files exist, read them.
  test -f /etc/sh_aliases && . /etc/sh_aliases
  test -f ./.aliases && . ./.aliases
else
  #mwe: Since Ash doesn't support aliases, we'll use a shell function to replace
  #     the regular "cd" command with one that changes directory AND changes the
  #     prompt to reflect the current directory.
  cd() {
    chdir $1
    export PS1="[$USER@$HOSTNAME]`pwd`:\$ "
  }
  cd $HOME
fi

