export 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. ##### My (demuredemeanor) bashrc sub source export script
  2. # Uses tabstop=4; shiftwidth=4 tabs; foldmarker={{{,}}};
  3. # https://notabug.org/demure/dotfiles/
  4. # legacy repo http://github.com/demure/dotfiles
  5. # vim:set syntax=sh:
  6. ### Exports ### {{{
  7. ### Universal Exports ### {{{
  8. export CLICOLOR="YES" ## Color 'ls', etc.
  9. export EDITOR=vim ## Set default editor
  10. ### History Settings ### {{{
  11. export HISTSIZE=100000 ## Size of shells hist
  12. export HISTFILESIZE=100000 ## Size of Hist file
  13. export HISTCONTROL=ignoreboth:erasedups
  14. export HISTTIMEFORMAT="%F %T " ## Adds time to history
  15. export HISTIGNORE='ls:bg:fg:history' ## Hist ignores exact match
  16. ### End History Settings ### }}}
  17. ### End Universal Exports ### }}}
  18. ### Fortune At Login ### {{{
  19. ## Tests for fortune, root, interactive shell, and dumb term
  20. if [ $(command -v fortune) ] && [ $UID != '0' ] && [[ $- == *i* ]] && [ $TERM != 'dumb' ]; then
  21. fortune -a
  22. else
  23. MISSING_ITEMS+="fortune, "
  24. fi
  25. ### End Fortune ### }}}
  26. ### Memo At Login ### {{{
  27. ## Tests for memo, root, interactive shell, and dumb term
  28. # http://www.getmemo.org/index.html
  29. if [ $(command -v memo) ] && [ $UID != '0' ] && [[ $- == *i* ]] && [ $TERM != 'dumb' ]; then
  30. ## If it has been four or more hours, show.
  31. if [ -e $HOME/.memo ] && [ "$(date +%s)" -ge "$(echo $(stat --printf=%Y $HOME/.memo) + 14400 | bc)" ]; then
  32. memo -u 2>/dev/null
  33. touch $HOME/.memo
  34. fi
  35. else
  36. MISSING_ITEMS+="memo, "
  37. fi
  38. ### End Memo ### }}}
  39. ### Taskwarrior At Login ### {{{
  40. ## Tests for task, root, interactive shell, and dumb term
  41. # http://taskwarrior.org/
  42. if [ $(command -v task) ] && [ $UID != '0' ] && [[ $- == *i* ]] && [ $TERM != 'dumb' ]; then
  43. ## Don't try to show if term is too small
  44. if [ $(tput cols) -ge 90 ]; then
  45. ## If it has been four or more hours, show.
  46. if [ -e $HOME/.task/pending.data ] && [ "$(date +%s)" -ge "$(echo $(stat --printf=%Y $HOME/.task/pending.data) + 14400 | bc)" ]; then
  47. task limit:5 2>/dev/null
  48. touch $HOME/.task/pending.data
  49. fi
  50. fi
  51. else
  52. MISSING_ITEMS+="taskwarrior, "
  53. fi
  54. ### End Taskwarrior ### }}}
  55. ### Grep Options ### {{{
  56. ## So, this code is because even though GREP_OPTIONS are 'dead',
  57. ## some servers still have older than grep 2.20...
  58. ## I'm using awk, as bash doesn't really do decimal
  59. grep_test="$(grep --version 2>/dev/null | awk 'BEGIN {VER=0; CUT=2.20} /^grep/ NR>1{if($NF!~/[a-z]/){VER=$NF}} END {if(VER<CUT){print "lt"} else {print "ge"}}')"
  60. if [ $grep_test == "ge" ]; then
  61. ## If new, do it the way grep says to
  62. alias grep='grep --color=auto --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn'
  63. else
  64. ## If old, use GREP_OPTIONS, as --exclude may not exist, and annoying errors!
  65. if echo hello | grep --color=auto l >/dev/null 2>&1; then
  66. GREP_OPTIONS+="--color=auto " GREP_COLOR='1;31'
  67. fi
  68. if echo hello | grep --exclude-dir=a l >/dev/null 2>&1; then
  69. for PATTERN in .cvs .git .hg .svn; do
  70. GREP_OPTIONS+="--exclude-dir=$PATTERN "
  71. done
  72. fi
  73. export GREP_OPTIONS
  74. fi
  75. ### End Grep Options ### }}}
  76. ### Nethack Conf ### {{{
  77. if [ -f $HOME/.nethackrc ]; then
  78. export NETHACKOPTIONS=~/.nethackrc
  79. else
  80. MISSING_ITEMS+="nethackrc, "
  81. fi
  82. ### End Nethack ### }}}
  83. ### Slash'em Conf ### {{{
  84. if [ -f $HOME/.slashemrc ]; then
  85. export SLASHEMOPTIONS=~/.slashemrc
  86. else
  87. MISSING_ITEMS+="slashemrc, "
  88. fi
  89. ### End Slash'em ### }}}
  90. # ### TERM color ### {{{
  91. # ## Disabled, as forcing is kind of bad >_>
  92. # ## http://blog.sanctum.geek.nz/term-strings/
  93. # if [ -e /usr/share/terminfo/x/xterm-256color ]; then
  94. # export TERM='xterm-256color'
  95. # else
  96. # export TERM='xterm-color'
  97. # fi
  98. # ### End TERM ### }}}
  99. #### End Exports ### }}}
  100. ## Adding PATH junk
  101. # evaluate if I can safely have MA's path higher...
  102. # put this is a location
  103. #export PATH=/usr/pkg/bin:/usr/local/bin:/usr/bin:/bin
  104. export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/local/bin:/usr/local/sbin:${HOME}/projects/personal/scripts:${HOME}/bin:${HOME}/.local/bin:/usr/local/games:/usr/games