Advertisement
Guest User

Untitled

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