# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
# 20 Sept 2016

# Test to see if user is root and set appropriate paths
#  root may need access to commands that do not use dynamic libraries.
if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi

# Export to all child processes the path defined
export PATH

# If PS1 is defined then being invoked by an interactive login
if [ "$PS1" ]; then
  # If being run as bash and not the older bourne emulation mode.
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # if /etc/bash.bashrc exists, source it for additional configuration
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi

  # else user is not logging in under standard bash conditions,
  else
    #  So check to see if user is root
    #  and pick the appropriate prompt : # for root, $ for all others.
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

# If the /etc/profile.d directory exists (additinional configuratin info)
if [ -d /etc/profile.d ]; then

  # Get any .sh (shell script) files listed in it 
  #  And source them.
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi