X-Git-Url: https://git.jankratochvil.net/?a=blobdiff_plain;f=.bashrc;h=b4bce39755839fcf092af4669707d78f504c55dc;hb=2afd01ae88a2581cbc87a5a413b7aacf36804de0;hp=ed501355cf47631fd05cdb0cc76e5984d595b12d;hpb=426fa1eb779a5d4b29ffaf7d552b4a01fc0cab61;p=nethome.git diff --git a/.bashrc b/.bashrc index ed50135..b4bce39 100644 --- a/.bashrc +++ b/.bashrc @@ -11,7 +11,12 @@ if [ -n "$_home_short_dotbashrc_norc" -o "${TERM#norc-}" != "$TERM" ];then fi if [ -z "$_home_short_dotbashrc" ];then - _home_short_dotbashrc=true + # We permit later reinitialization by unsetting it. + # During our execution we forbid spawning to prevent deadlock by: + # source /etc/bashrc + # . /etc/profile.d/lang.sh + # unicode_start iso02.08 + export _home_short_dotbashrc=true # $TERM gets restored to its 'norc-' state after ~/.bashrc # alias norc='TERM="norc-$TERM" ssh -t -o 'NoHostAuthenticationForLocalhost yes' $USER@localhost "cd $PWD; TERM=$TERM;"' function norc { TERM="norc-$TERM" ssh -t -o 'NoHostAuthenticationForLocalhost yes' $USER@localhost "cd $PWD; TERM=$TERM;" "$@"; }; export -f norc @@ -20,7 +25,7 @@ if [ -f /etc/bashrc ];then source /etc/bashrc;fi function _bash_profile_addpath # , { - 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 @@ -35,8 +40,14 @@ function _bash_profile_addpath # , 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" } @@ -83,13 +94,8 @@ _bash_profile_addpath -s ANT_HOME "/usr/local/ant" # /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,/share/perl,/lib/perl}{,/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 @@ -137,7 +143,7 @@ for file in $HOME/.bookmarks.html;do 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 @@ -187,7 +193,7 @@ function finame { find . -false ` 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 );print pop @r while @r;'; }; export -f revlines -ulimit -c 0 +ulimit -S -c 0 set +H shopt -s mailwarn unset OPTIND