+# $Id$
+
+
if [ -n "$_home_short_dotbashrc_norc" -o "${TERM#norc-}" != "$TERM" ];then
# We could get executed twice:
export _home_short_dotbashrc_norc=true
function _bash_profile_addpath # <variablename>,<dirpathname>
{
- local _varname _dirpathname _opt_f _opt_s
+ local _varname _varval _varvalold _dirpathname _opt_f _opt_s
_opt_f=0;_opt_s=0
unset OPTIND
while getopts fs got;do
if [ $_opt_s = 1 -o -z "`eval "echo \\${$_varname}"`" ];then
eval "$_varname='$_dirpathname'"
else
- # we want to override any original directories, place dirpathname first!
- eval "$_varname=\"$_dirpathname:\${$_varname}\""
+ # We want to override any original directories, place dirpathname first!
+ # We want to prevent duplicates due to .bashrc reentrancy across fork(2)s.
+ eval "_varval=\":\${$_varname}:\""
+ until [ "$_varval" = "$_varvalold" ];do
+ _varvalold="$_varval"
+ eval "_varval=\"$(echo "$_varval"|sed "s#:$_dirpathname:#:#g")\""
+ done
+ eval "$_varname=\"$_dirpathname$(echo "$_varval"|sed "s#:\$##g")\""
fi
export "$_varname"
}
_bash_profile_addpath -s CVSROOT "$HOME/cvs"
_bash_profile_addpath -s ANT_HOME "/usr/local/ant"
+# /share/perl for Debian
+# /lib/perl for Debian
+# /lib/perl5 for Fedora Core
mkdir -p $HOME/lib/perl5 # otherwise CPAN will install to "$HOME/lib/site_perl" etc.
-for _perldir in $(eval "echo {/usr,$HOME}/lib/perl5{,/site_perl}$(
- for perlvar in version archname;do
- echo -n '{,/'
- perl -V:"$perlvar"|cut -d "'" -f 2|tr -d '\n'
- echo -n '}'
- done
- )");do
+_perlpatt="$(perl -MConfig -e 'print "{,/".$Config{$_}."}" for qw(version archname);')"
+for _perldir in $(eval "echo {/usr,$HOME}{/lib/perl5,/share/perl,/lib/perl}{,/site_perl}$_perlpatt");do
_bash_profile_addpath -f PERLLIB "$_perldir"
done
unset _perldir
alias vi='vim'
alias grepb='grep --binary-files=binary'
alias L='lynx'
+alias cvs2cl='cvs2cl --window 3600 --separate-header --no-wrap'
alias cvsfiles='cvsutil --files --print'
alias cvsignores='cvsutil --ignores --print'
alias cvsignoresall='cvsutil --ignores --workings --print'
alias cvsignoresrmall='cvsutil --ignores --workings --rm'
alias cvsignoresallrm='cvsutil --ignores --workings --rm'
[ "`uname`" = "SunOS" -a -x $HOME/bin/rpm-by-pkg ] && alias rpm='rpm-by-pkg'
+alias rpmdb='rpm --define "_dbpath `echo /usr/lib/rpmdb/*/*`"'
-weberr="/var/log/httpd/error/klokan.error_log"
-if [ -f "$weberr" ];then alias weberr='tail "$weberr"';fi
-weblog="/var/log/httpd/klokan.access_log"
-if [ -f "$weblog" ];then alias weblog='tail -n 20000 "$weblog"|grep "\\(~\\|%7[eE]\\)short"';fi
+# '2>/dev/null' to prevent: unalias: x: not found
+unalias 2>/dev/null cp # -i
+unalias 2>/dev/null mv # -i
+unalias 2>/dev/null rm # -i
+unalias 2>/dev/null df # -h
+unalias 2>/dev/null du # -h
export IGNOREEOF=10
-export TMOUT=900
+# '2>/dev/null' to prevent: TMOUT: readonly variable
+export TMOUT=900 2>/dev/null
export EDITOR='vim'
[ -x /bin/less ] && export PAGER='/bin/less -MMh5cis'
export PERL_MM_OPT="PERL=$HOME/bin/perlilib"
export WWW_HOME="file://$HOME/"
[ -r $file ] && export WWW_HOME="file://$file"
done
-export GREP_OPTIONS="--binary-files=without-match --directories=skip"
+export GREP_OPTIONS="--binary-files=without-match --directories=skip --exclude=tags --exclude=TAGS --exclude=CVS"
if [ -n "$PS1" ];then # set only in interactive sessions
export PS1='[bash]${LOGNAME}@${HOSTNAME}:${PWD}# '
export PS1='\[\017\]'"$PS1" # \017=std charmap
export LANG=en_US.UTF-8
# Force strcoll() to sort case-sensitively! (empty/undef doesn't work)
export LC_COLLATE=C
-# Prevent: perl: warning: Setting locale failed.
-# due to LC_COLLATE=C and LC_ALL=(unset)
-export LC_ALL=C
+# Do not: # Prevent: perl: warning: Setting locale failed.
+# # due to LC_COLLATE=C and LC_ALL=(unset)
+# export LC_ALL=C
+# as it breaks Mutt "utf-8" and somehow it is no longer needed.
function cvsdiff { cvs diff "$@" 2>&1|pipebuf -q| less; }; export -f cvsdiff
function cvsdiffi { cvs diff "$@" 2>&1|pipebuf -q|grep -v '^?'|less; }; export -f cvsdiffi
function mkcd { mkdir -p "$1"; cd "$1"; }; export -f mkcd
function pushdmk { mkdir -p "$1"; pushd "$1"; }; export -f pushdmk
function rsync {(unset rsync; rsync -v -e ssh --progress --stats --partial --block-size=512 "$@"; );}; export -f rsync
-function tohex { od -An -txC /tmp/out|tr -d '\n '|tr 'a-f' 'A-F';echo; }; export -f tohex
+function tohex { od -An -txC|tr -d '\n '|tr 'a-f' 'A-F';echo; }; export -f tohex
function edall {
find -type f|while read -r i;do
(awk </dev/null 'BEGIN{ for (i=1;i<ARGC;i++) print ARGV[i]; }' "$@";echo -e 'w\nq')|ed -s "$i"
); };export -f mi
function ctags {(unset ctags;
if [ $# -ne 0 -a '(' $# -ne 1 -o "$1" '!=' "--c-types=+px" ')' ];then ctags "$@";else
- find -type f -a '(' -false \
+ find -type f -a '!' -name tags -a '!' -name TAGS -a '(' -false \
-o -name "*.[chC]" \
-o -name "*.cc" \
-o -name "*.java" \