profile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # Begin /etc/profile
  2. # Written for Beyond Linux From Scratch
  3. # by James Robertson <jameswrobertson@earthlink.net>
  4. # modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg>
  5. # System wide environment variables and startup programs.
  6. # System wide aliases and functions should go in /etc/bashrc. Personal
  7. # environment variables and startup programs should go into
  8. # ~/.bashrc.
  9. # Functions to help us manage paths. Second argument is the name of the
  10. # path variable to be modified (default: PATH)
  11. if [ -f /etc/locale.conf ];then
  12. . /etc/locale.conf
  13. export LC_ALL="$LC_ALL"
  14. export LANG="$LANG"
  15. export LANGUAGE="$LANGUAGE"
  16. else
  17. export LC_ALL="tr_TR.UTF-8"
  18. export LANG="tr_TR.UTF-8"
  19. export LANGUAGE="tr_TR.UTF-8"
  20. fi
  21. pathremove () {
  22. local IFS=':'
  23. local NEWPATH
  24. local DIR
  25. local PATHVARIABLE=${2:-PATH}
  26. for DIR in ${!PATHVARIABLE} ; do
  27. if [ "$DIR" != "$1" ] ; then
  28. NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
  29. fi
  30. done
  31. export $PATHVARIABLE="$NEWPATH"
  32. }
  33. pathprepend () {
  34. pathremove $1 $2
  35. local PATHVARIABLE=${2:-PATH}
  36. export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
  37. }
  38. pathappend () {
  39. pathremove $1 $2
  40. local PATHVARIABLE=${2:-PATH}
  41. export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
  42. }
  43. export -f pathremove pathprepend pathappend
  44. # Set the initial path
  45. export PATH=/usr/bin:/bin:/usr/sbin:/sbin
  46. if [ $EUID -eq 0 ] ; then
  47. unset HISTFILE
  48. fi
  49. # Setup some environment variables.
  50. export HISTSIZE=1000
  51. export HISTIGNORE="&:[bf]g:exit"
  52. # Set some defaults for graphical systems
  53. export XDG_DATA_DIRS=/usr/share/
  54. export XDG_CONFIG_DIRS=/etc/xdg/
  55. # Setup a red prompt for root and a green one for users.
  56. NORMAL="\[\e[0m\]"
  57. RED="\[\e[1;31m\]"
  58. GREEN="\[\e[1;32m\]"
  59. if [[ $EUID == 0 ]] ; then
  60. PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
  61. else
  62. PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
  63. fi
  64. for script in /etc/profile.d/*.sh ; do
  65. if [ -r $script ] ; then
  66. . $script
  67. fi
  68. done
  69. unset script RED GREEN NORMAL
  70. # End /etc/profile