Advertisement
Guest User

Untitled

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