export MINICOM="-m -c on" # metakeys+color
[nethome.git] / .bashrc
1 if [ -z "$_home_short_dotbashrc" ];then
2         _home_short_dotbashrc=true
3
4 if [ -f /etc/bashrc ];then source /etc/bashrc;fi
5
6 function _bash_profile_addpath  # variable,dirpathname
7 {
8         if [ '!' -d "$2" ];then return;fi
9         if [ -n "$3" -o -z "`eval "echo \\${$1}"`" ];then
10                 eval "$1='$2'"
11         else
12                 # we want to override any original directories, place dirpathname first!
13                 eval "$1=\"$2:\${$1}\""
14         fi
15         export "$1"
16 }
17
18 _bash_profile_addpath PATH            "$HOME/bin"
19 _bash_profile_addpath PATH            "$HOME/sbin"
20 _bash_profile_addpath LD_LIBRARY_PATH "$HOME/lib"
21 _bash_profile_addpath MANPATH         "$HOME/man"
22
23 _bash_profile_addpath CVSROOT         "$HOME/cvs" single
24 _bash_profile_addpath CVSROOT         "$HOME/pserver/cvs" single
25
26 for _perldir in $(eval "echo $HOME/lib/perl5/site_perl$(
27         for perlvar in version archname;do
28                 echo -n '{,/'
29                 perl -V:"$perlvar"|cut -d "'" -f 2|tr -d '\n'
30                 echo -n '}'
31                 done
32         )");do
33         _bash_profile_addpath PERLLIB "$_perldir"
34         done
35 unset _perldir
36
37 unset -f _bash_profile_addpath
38
39 alias ls='ls -bF'
40 alias l='ls -lbF'
41 alias maple="ssh -t vega.fjfi.cvut.cz maple"
42 #alias cc='cc -I/home/short/include'
43 alias vi='vim'
44 alias grepb='grep --binary-files=binary'
45 alias L='lynx'
46
47 weberr="/var/log/httpd/error/klokan.error_log"
48 if [ -f "$weberr" ];then alias weberr='tail "$weberr"';fi
49 weblog="/var/log/httpd/klokan.access_log"
50 if [ -f "$weblog" ];then alias weblog='tail -n 20000 "$weblog"|grep "\\(~\\|%7[eE]\\)short"';fi
51
52 export IGNOREEOF=10
53 export TMOUT=900
54 export EDITOR='vim'
55 export LC_CTYPE=cs_CZ.ISO-8859-2
56 export PERL_MM_OPT="PREFIX=$HOME"
57 export WWW_HOME="file:///home/short/.bookmarks.html"
58 export GREP_OPTIONS="--binary-files=without-match --directories=skip"
59 export MINICOM="-m -c on"       # metakeys+color
60 export HISTSIZE=100000
61 export HISTFILESIZE="$HISTSIZE"
62 export CVS_RSH="ssh"
63
64 # even when LANG is set to "en_US" it is lethal - strcoll() starts to sort case-insensitively!
65 unset LANG
66
67 function cvsdiff    { cvs diff   "$@" 2>&1|pipebuf -q|             less; }; export -f cvsdiff
68 function cvsdiffi   { cvs diff   "$@" 2>&1|pipebuf -q|grep -v '^?'|less; }; export -f cvsdiffi
69 function cvsupdate  { cvs update "$@" 2>&1|pipebuf -q|             less; }; export -f cvsupdate
70 function cvsupdatei { cvs update "$@" 2>&1|pipebuf -q|grep -v '^?'|less; }; export -f cvsupdatei
71 function cvsfiles {
72         for i in `find . -name Entries|grep '/CVS/Entries$'`;do
73                 j="`echo "$i"|sed 's,CVS/Entries$,,'`"
74                 sed -n 's,^/\([^/]*\)/[^-].*$,'"$j"'\1,p' <$i
75                 done \
76                 | sed 's%^\./%%'
77         }; export -f cvsfiles
78 function cvsignore {
79         for i in `find . -name .cvsignore`;do
80                 j="`echo "$i"|sed 's,\.cvsignore$,,'`"
81                 sed -n 's,^.*$,'"$j"'&,p' <$i
82                 done
83         }; export -f cvsignore
84 function cvsignorerm { cvsignore | xargs rm -f; }; export -f cvsignorerm
85 function cvsignoreall {
86         (find -type f|sed -e '\#/CVS/[^/]*$#d' -e 's#^\./##';cvsfiles)|sort|uniq -c|sed -n "s/^ *1`echo -e '\t'`//p"
87         }; export -f cvsignoreall
88 function cvsignoreallrm { cvsignoreall | xargs rm -f; }; export -f cvsignoreallrm
89
90 function wclines { awk '{x[$0]++}END{for (i in x) print x[i]"\t"i}'; }; export -f wclines
91 function ulimitme { ulimit -m 100000 -d 150000 -v 200000; }; export -f ulimitme
92 function grep { ( ulimitme; `which grep` "$@"; ); }; export -f grep
93 function finame { find . -false `
94         awk </dev/null 'BEGIN{ for (i=1;i<ARGC;i++) print " -o -iname *"ARGV[i]"*"; }' "$@";
95         `; }; export -f finame
96 function rsync { `which rsync` -v -e ssh --progress --stats --partial --block-size=512 "$@"; }; export -f rsync
97 function tohex { od -An -txC /tmp/out|tr -d '\n '|tr 'a-f' 'A-F';echo; }; export -f tohex
98 function edall {
99         find -type f|while read -r i;do
100                 (awk </dev/null 'BEGIN{ for (i=1;i<ARGC;i++) print ARGV[i]; }' "$@";echo -e 'w\nq')|ed -s "$i"
101                 done
102         }; export -f edall
103 function mi { (
104         set -ex;cd "$1";while true;do test "$PWD" != "/";if [ -e configure.in -o -e Makefile.PL ];then break;fi;cd ..;done;make install;
105         ); };export -f mi
106 function ctags {
107         if [ $# != 0 ];then `which ctags` "$@";else
108                 rm -f tags;find -type f -a '(' -name "*.[chC]" -o -name "*.cc" -o -name "*.java" ')'|xargs `which ctags` -a --file-tags
109         fi; }; export -f ctags
110
111 ulimit -c 0
112 set +H
113 shopt -s mailwarn
114
115 if [ -f "$HOME/.bashrc.local" ];then source "$HOME/.bashrc.local";fi
116
117         unset _home_short_dotbashrc     # permit later reinitializations
118 fi      # _home_short_dotbashrc