| 1 | # vim:filetype=sh |
| 2 | # .bashrc, the minimal stuff I can't live without |
| 3 | |
| 4 | ## file include macro, tests for readability |
| 5 | include() { |
| 6 | local arg |
| 7 | |
| 8 | for arg; do |
| 9 | if [ -r "$arg" ]; then |
| 10 | . "$arg" |
| 11 | fi |
| 12 | done |
| 13 | } |
| 14 | |
| 15 | ## grep speedup hack |
| 16 | if test -n "$LC_ALL"; then |
| 17 | lc_all="$LC_ALL" |
| 18 | LC_ALL=C |
| 19 | else |
| 20 | LC_ALL=C |
| 21 | fi |
| 22 | export LC_ALL |
| 23 | |
| 24 | ## include in every shell |
| 25 | include ~/.bash_functions_noti |
| 26 | |
| 27 | ## gen PATH, etc. |
| 28 | repath |
| 29 | |
| 30 | ## interactive shell? |
| 31 | if [ -n "$PS1" ]; then |
| 32 | ## interactive shell, so non-interactive, non-login child shells |
| 33 | ## should also load this file if started manually |
| 34 | export BASH_ENV="~/.bashrc" |
| 35 | |
| 36 | ## include only in interactive shells |
| 37 | include ~/.bash_functions ~/.bash_aliases ~/.bash_prompt \ |
| 38 | ~/.bashrci ~/.bash_local |
| 39 | fi |
| 40 | |
| 41 | ## always define PAGER and EDITOR |
| 42 | if _exists vim; then |
| 43 | EDITOR=vim |
| 44 | else |
| 45 | EDITOR=vi |
| 46 | fi |
| 47 | |
| 48 | if _exists less; then |
| 49 | PAGER=less |
| 50 | else |
| 51 | PAGER=more |
| 52 | fi |
| 53 | |
| 54 | ## less options: |
| 55 | ## R - output ANSI color escape sequences as-is |
| 56 | ## d - don't complain if terminal is dumb |
| 57 | ## i - case-insensitive search by default; note that any upper-case letter |
| 58 | ## makes the search case-sensitive |
| 59 | ## s - consecutive blank lines are squeezed into a single blank line |
| 60 | ## F - quit if output fits in one screen |
| 61 | ## X - don't send termcap init/de-init strings to terminal (prevents cls) |
| 62 | ## M - display in prompt displayed lines / total |
| 63 | LESS="-RdisFXM" |
| 64 | |
| 65 | type -p lesspipe &> /dev/null && eval `lesspipe` |
| 66 | [ -x /usr/bin/lesspipe.sh ] && export LESSOPEN="|/usr/bin/lesspipe.sh %s" |
| 67 | |
| 68 | export EDITOR PAGER LESS |
| 69 | |
| 70 | ## include in every shell |
| 71 | include ~/.bash_local_noti |
| 72 | |
| 73 | ## undo grep speedup hack |
| 74 | if test -n "$lc_all"; then |
| 75 | LC_ALL="$lc_all" |
| 76 | unset lc_all |
| 77 | else |
| 78 | unset LC_ALL |
| 79 | fi |
| 80 | |
| 81 | if [ $EUID -eq 0 ]; then |
| 82 | # files go-w |
| 83 | umask 022 |
| 84 | else |
| 85 | # files o-w |
| 86 | umask 002 |
| 87 | fi |
| 88 | |
| 89 | # dump cores |
| 90 | ulimit -c unlimited |
| 91 | |
| 92 | ## use ssh instead of rsh in cvs |
| 93 | CVS_RSH=ssh |
| 94 | |
| 95 | ## gzip: maximum compression |
| 96 | GZIP="-9" |
| 97 | |
| 98 | export CVS_RSH GZIP |
| 99 | |