Fixed _bash_profile_addpath to prevent $OPTIND corruption.
authorshort <>
Wed, 22 Dec 2004 21:51:26 +0000 (21:51 +0000)
committershort <>
Wed, 22 Dec 2004 21:51:26 +0000 (21:51 +0000)
Remove forced set of: LC_CTYPE
Switch interactive mode to UTF-8.
Fixed ulimitme to cope with weird $IFS values.

.bashrc

diff --git a/.bashrc b/.bashrc
index e1e845b..b1eaeeb 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -17,7 +17,8 @@ if [ -f /etc/bashrc ];then source /etc/bashrc;fi
 
 function _bash_profile_addpath # <variablename>,<dirpathname>
 {
 
 function _bash_profile_addpath # <variablename>,<dirpathname>
 {
-       _OPTIND="$OPTIND"
+       local OPTIND
+       local _varname _dirpathname _opt_f _opt_s
        _opt_f=0;_opt_s=0
        OPTIND=1;while getopts fs got;do
                case "$got" in
        _opt_f=0;_opt_s=0
        OPTIND=1;while getopts fs got;do
                case "$got" in
@@ -35,8 +36,6 @@ function _bash_profile_addpath        # <variablename>,<dirpathname>
                eval "$_varname=\"$_dirpathname:\${$_varname}\""
        fi
        export "$_varname"
                eval "$_varname=\"$_dirpathname:\${$_varname}\""
        fi
        export "$_varname"
-       unset _varname _dirpathname _opt_f _opt_s
-       OPTIND="$_OPTIND";unset _OPTIND
 }
 
 # Use reverse order of preferred directories:
 }
 
 # Use reverse order of preferred directories:
@@ -120,7 +119,6 @@ export IGNOREEOF=10
 export TMOUT=900
 export EDITOR='vim'
 [ -x /bin/less ] && export PAGER='/bin/less -MMh5cis'
 export TMOUT=900
 export EDITOR='vim'
 [ -x /bin/less ] && export PAGER='/bin/less -MMh5cis'
-[ "`uname`" = "SunOS" ] || export LC_CTYPE=cs_CZ.ISO-8859-2
 export PERL_MM_OPT="PERL=$HOME/bin/perlilib"
 [ "$UID" -ne 0 ] && export PERL_MM_OPT="$PERL_MM_OPT PREFIX=$HOME"
 for file in $HOME/.bookmarks.html;do
 export PERL_MM_OPT="PERL=$HOME/bin/perlilib"
 [ "$UID" -ne 0 ] && export PERL_MM_OPT="$PERL_MM_OPT PREFIX=$HOME"
 for file in $HOME/.bookmarks.html;do
@@ -130,9 +128,9 @@ for file in $HOME/.bookmarks.html;do
 export GREP_OPTIONS="--binary-files=without-match --directories=skip"
 if [ -n "$PS1" ];then  # set only in interactive sessions
        export PS1='[bash]${LOGNAME}@${HOSTNAME}:${PWD}# '
 export GREP_OPTIONS="--binary-files=without-match --directories=skip"
 if [ -n "$PS1" ];then  # set only in interactive sessions
        export PS1='[bash]${LOGNAME}@${HOSTNAME}:${PWD}# '
-       # kbd_mode -u   # utf-8
-       # export PS1='\[\017\033%G\]'"$PS1"     # \017=std charmap, \033%G=utf-8
-       export PS1='\[\017\]'"$PS1"     # \017=std charmap
+       kbd_mode -u     # utf-8
+       export PS1='\[\017\033%G\]'"$PS1"       # \017=std charmap, \033%G=utf-8
+       # export PS1='\[\017\]'"$PS1"   # \017=std charmap
        fi
 export MINICOM="-m -c on"      # metakeys+color
 export HISTSIZE=100000
        fi
 export MINICOM="-m -c on"      # metakeys+color
 export HISTSIZE=100000
@@ -157,7 +155,9 @@ export ULIMITME_OPTS=""
 for i in "-m 100000" "-d 150000" "-v 200000";do
        (ulimit $i 2>/dev/null) && ULIMITME_OPTS="$ULIMITME_OPTS $i"
        done
 for i in "-m 100000" "-d 150000" "-v 200000";do
        (ulimit $i 2>/dev/null) && ULIMITME_OPTS="$ULIMITME_OPTS $i"
        done
-function ulimitme { ulimit $ULIMITME_OPTS; }; export -f ulimitme
+# Prevent: ulimit:  -m 100000 -d 150000 -v 200000: invalid number
+# by forcing our known $IFS value; eval(1) is needed to take $IFS to effect:
+function ulimitme { IFS=" " eval "ulimit $ULIMITME_OPTS"; }; export -f ulimitme
 function grep {(unset grep; ( ulimitme; grep "$@"; ); );}; export -f grep
 function finame { find . -false `
        awk </dev/null 'BEGIN{ for (i=1;i<ARGC;i++) print " -o -iname *"ARGV[i]"*"; }' "$@";
 function grep {(unset grep; ( ulimitme; grep "$@"; ); );}; export -f grep
 function finame { find . -false `
        awk </dev/null 'BEGIN{ for (i=1;i<ARGC;i++) print " -o -iname *"ARGV[i]"*"; }' "$@";