profile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ##
  2. ## @l_prefix@/etc/bash/profile -- Global Bash Profile
  3. ##
  4. # welcome and goodbye message ;)
  5. echo "$HOSTNAME: user $USER, login at `date`"
  6. trap 'echo "$HOSTNAME: user $USER, logout at `date`"' 0
  7. # initially adjust $PWD to symbolic path
  8. cd $HOME
  9. # provide user and host information in default prompt
  10. PS1="\u@\h\$ "
  11. # session timeout
  12. export TMOUT=3600
  13. # environment permissions
  14. umask 022
  15. ulimit -c 16384
  16. if [ ".$PS1" != . ]; then
  17. mesg y
  18. fi
  19. # history functionality
  20. shopt -s histappend
  21. HISTSIZE=100
  22. HISTFILESIZE=100
  23. alias h='history | $PAGER'
  24. # various additional variables
  25. export TMPDIR=/tmp
  26. export TEMPDIR=$TMPDIR
  27. export BLOCKSIZE=1024
  28. # turn on extended globbing
  29. shopt -s extglob no_empty_cmd_completion
  30. # make directory commands see only directories
  31. complete -d cd mkdir rmdir pushd
  32. # make file commands see only (their) files
  33. complete -f cat less more ln strip
  34. complete -f -X '*.bz2' bzip2
  35. complete -f -X '!*.bz2' bunzip2
  36. complete -f -X '!*.zip' unzip
  37. complete -f -X '*.gz' gzip
  38. complete -f -X '*.Z' compress
  39. complete -f -X '!*.+(Z|gz|tgz|Gz)' gunzip zcat zmore
  40. complete -f -X '!*.Z' uncompress zmore zcat
  41. complete -f -X '!*.+(gif|jpg|jpeg|GIF|JPG|bmp)' xv display
  42. complete -f -X '!*.+(ps|PS|ps.gz)' gv gs mgv
  43. complete -f -X '!*.+(dvi|DVI)' dvips xdvi
  44. complete -f -X '!*.+(pdf|PDF)' acroread xpdf
  45. complete -f -X '!*.texi*' makeinfo texi2dvi texi2html
  46. complete -f -X '!*.+(tex|TEX)' tex latex
  47. complete -f -X '!*.+(c|cc|C|h|hh|H)' cc gcc
  48. # make signal and job commands see only signals/jobs
  49. complete -A signal kill -P '%'
  50. complete -A stopped -P '%' bg
  51. complete -j -P '%' fg jobs
  52. # make user/group commands see only users/groups
  53. complete -u passwd su finger
  54. complete -u passwd
  55. # make network commands see only hostnames
  56. complete -A hostname ssh rsh telnet rlogin ftp ping host traceroute nslookup dig
  57. # make internal commands see only their possibilities
  58. complete -v export local readonly unset
  59. complete -A setopt set
  60. complete -A shopt shopt
  61. complete -A helptopic help
  62. complete -a unalias
  63. complete -A binding bind
  64. # convinient root priviledge switching
  65. root () {
  66. if [ $# -eq 0 -o ".$1" = ".-i" ]; then
  67. ssh -t -x root@localhost cd $PWD \&\& exec ${SHELL-/bin/sh}
  68. elif [ ".$1" = ".-l" ]; then
  69. ssh -x root@localhost cd $PWD \&\& `history | tail -2 | head -1 | cut -c8-`
  70. elif [ ".$1" = ".-t" ]; then
  71. shift
  72. ssh -t -x root@localhost cd $PWD \&\& "$@"
  73. else
  74. ssh -x root@localhost cd $PWD \&\& "$@"
  75. fi
  76. }
  77. # suck in the Bourne-Shell environment of all OpenPKG packages
  78. eval `@l_prefix@/etc/rc -p all env:sh`
  79. # path to user environment init script
  80. if [ -f "$HOME/.bashrc" ]; then
  81. BASH_ENV=$HOME/.bashrc
  82. . $BASH_ENV
  83. fi