Fix to not run gdbserver.
[nethome.git] / .bashrc
1 if [ -n "$_home_short_dotbashrc_norc" -o "${TERM#norc-}" != "$TERM" ];then
2         # We could get executed twice:
3         export _home_short_dotbashrc_norc=true
4         # Do not use $TZ as Solaris sshd(8) does not propagate it.
5         # Be aware you must use 'ssh -t' to propagate $TERM otherwise '=dumb'.
6         export TERM="${TERM#norc-}"
7         export _home_short_dotbashrc=true
8 fi
9
10 # "$PS1" for interactive shells detection.
11 if [ -n "$PS1" -a -z "$_home_short_dotbashrc" ];then
12         # We permit later reinitialization by unsetting it.
13         # During our execution we forbid spawning to prevent deadlock by:
14         #       source /etc/bashrc
15         #       . /etc/profile.d/lang.sh
16         #       unicode_start iso02.08
17         export _home_short_dotbashrc=true
18         # $TERM gets restored to its 'norc-' state after ~/.bashrc
19         # alias norc='TERM="norc-$TERM" ssh -t -o 'NoHostAuthenticationForLocalhost yes' $USER@localhost "cd $PWD; TERM=$TERM;"'
20         function norc { TERM="norc-$TERM" ssh -t -o 'NoHostAuthenticationForLocalhost yes' $USER@localhost "cd $PWD; TERM=$TERM;" "$@"; }
21
22 # Fix $USER and $LOGNAME (not $MAIL) for /etc/passwd line:
23 # root-lace:x:0:0:root for Jan Kratochvil:/home/root-lace:/bin/bash
24 if [ "$UID" -eq 0 -a "$USER" = "root" -a "$HOME" != "${HOME#*/root-}" ];then
25         USER="${HOME##*/}"
26         LOGNAME="$USER"
27 fi
28
29 if [ -f /etc/bashrc ];then source /etc/bashrc;fi
30
31 _bash_profile_addpath_fini=""
32 function _bash_profile_addpath  # <variablename>,<dirpathname>
33 {
34         local _varname _varval _varvalold _dirpathname _opt_f _opt_s
35         _opt_f=0;_opt_s=0
36         unset -v OPTIND
37         while getopts fs got;do
38                 case "$got" in
39                         [fs]) eval "_opt_$got=1" ;;
40                         *) return 1 ;;
41                         esac
42                 done
43         eval "_varname=\"\$$[$OPTIND+0]\""
44         eval "_dirpathname=\"\$$[$OPTIND+1]\""
45         if [ $_opt_f = 0 -a '!' -d "$_dirpathname" ];then return;fi
46         if [ $_opt_s = 1 -o -z "`eval "echo \\${$_varname}"`" ];then
47                 eval "$_varname='$_dirpathname'"
48         else
49                 # We want to prevent duplicates due to .bashrc reentrancy across fork(2)s. It is array!
50                 _bash_profile_addpath_fini="$_bash_profile_addpath_fini $_varname"
51                 # We want to override any original directories, place dirpathname first!
52                 eval "$_varname=\"$_dirpathname:\${$_varname}\""
53         fi
54         export "$_varname"
55 }
56 function _bash_profile_addpath_fini
57 {
58         local _varname
59         for _varname in `echo "$_bash_profile_addpath_fini"|tr ' ' '\n'|sort -u`;do
60                 eval "$_varname=\"`eval $(echo "echo \"\\$$_varname\"")|awk -v RS=':' '/[^\n]/{if (!x[$0]++) e=e":"$0;}END{print substr(e,2)}'`\""
61                 done
62         unset -v _bash_profile_addpath_fini
63 }
64
65 # Use reverse order of preferred directories:
66 # gid(1) dependency on: /opt/sfw/bin
67 # EUID="`id -u 2>/dev/null || /usr/xpg4/bin/id -u 2>/dev/null || gid -u`"
68 _bash_profile_addpath -f PATH            "/sbin"
69 _bash_profile_addpath -f PATH            "/usr/sbin"
70 _bash_profile_addpath -f PATH            "/bin"
71 _bash_profile_addpath -f PATH            "/usr/bin"
72 _bash_profile_addpath    PATH            "/usr/lib/ccache"
73 _bash_profile_addpath    PATH            "/usr/lib64/ccache"
74 [ $EUID -eq 0 ] && _bash_profile_addpath -f PATH "/usr/local/sbin"
75 _bash_profile_addpath -f PATH            "/usr/local/bin"
76 _bash_profile_addpath -f MANPATH         "/usr/X11R6/man"
77 _bash_profile_addpath -f MANPATH         "/usr/share/man"
78 _bash_profile_addpath -f MANPATH         "/usr/local/man"
79 _bash_profile_addpath -s JAVA_HOME       "/usr/java"
80 _bash_profile_addpath -s JAVA_HOME       "/usr/local/java"
81 uname_p="`uname -p 2>/dev/null || uname -m`"
82 for family in $HOME;do
83         for arch in $family $family/$uname_p;do
84                 # Do not "-f": We use /net !
85                 _bash_profile_addpath PATH            "$arch/bin"
86                 _bash_profile_addpath -s JAVA_HOME    "$arch/java"
87                 [ $EUID -eq 0 ] && _bash_profile_addpath PATH "$arch/sbin"
88                 _bash_profile_addpath LD_LIBRARY_PATH "$arch/lib64"
89                 _bash_profile_addpath LD_LIBRARY_PATH "$arch/lib"
90                 _bash_profile_addpath MANPATH         "$arch/man"
91                 done
92         done
93 _bash_profile_addpath -f -s CVSROOT ":pserver:pserver:@cvs.jankratochvil.net/cvs"       # default
94 [ -n "$JAVA_HOME" ] && _bash_profile_addpath PATH "$JAVA_HOME/bin"
95 _bash_profile_addpath    -s CVSROOT "$HOME/pserver/cvs"
96 _bash_profile_addpath    -s CVSROOT "$HOME/cvs"
97 _bash_profile_addpath    -s ANT_HOME "/usr/local/ant"
98
99 for _perldir in $(eval "echo $HOME{/share,/lib{,64}}/perl5{/site_perl,}");do
100         _bash_profile_addpath -f PERL5LIB "$_perldir"
101         done
102 unset _perldir
103
104 unset -f _bash_profile_addpath
105 _bash_profile_addpath_fini
106 unset -f _bash_profile_addpath_fini
107
108 # '2>/dev/null' to prevent: unalias: x: not found
109 # It must be run before `function's below as otherwise it would get embedded.
110 unalias 2>/dev/null cp  # -i
111 unalias 2>/dev/null mv  # -i
112 unalias 2>/dev/null rm  # -i
113 unalias 2>/dev/null df  # -h
114 unalias 2>/dev/null du  # -h
115 unalias 2>/dev/null ls  # --color=auto
116 unalias 2>/dev/null l.  # ls -d .* --color=auto
117 unalias 2>/dev/null ll  # ls -l --color=auto
118 unalias 2>/dev/null grep        # grep --color=auto
119
120 # Prevent processing of aliases during the parsing of this script file by
121 # `eval':
122 eval '
123         function grep {(unset grep; ( ulimitme; grep "$@"; ); );}
124         function ls {(unset ls; ( ls -bF "$@"; ); );}
125         function l { ls -lbF "$@"; }
126         if which vim &>/dev/null;then
127                 alias vi="vim"
128         else
129                 echo >&2 "WARNING: No vim(1)."
130         fi
131         function grepb { grep --binary-files=binary "$@"; }
132         function L { lynx "$@"; }
133         function chown {(unset chown; ( chown --no-dereference "$@"; ); );}
134         function chgrp {(unset chgrp; ( chgrp --no-dereference "$@"; ); );}
135         function hexedit {(unset hexedit; ( hexedit -s "$@"; ); );}
136         function cvs2cl {(unset cvs2cl; ( cvs2cl --window 3600 --separate-header --no-wrap "$@"; ); );}
137         function cvsfiles { cvsutil --files --print "$@"; }
138         function cvsignores { cvsutil --ignores --print "$@"; }
139         function cvsignoresall { cvsutil --ignores --workings --print "$@"; }
140         function cvsignoresrm { cvsutil --ignores --rm "$@"; }
141         function cvsignoresrmall { cvsutil --ignores --workings --rm "$@"; }
142         function cvsignoresallrm { cvsutil --ignores --workings --rm "$@"; }
143         function svnignoresall { svn status |sed -n "s/^[?]      //p" "$@"; }
144         function svnignoresallrm { svn status |sed -n "s/^[?]      //p"|tr "\n" "\0"|xargs -0 rm -rf "$@"; }
145         function ignores { find -name "*.orig" -o -name ".#*" -o -name "*~" "$@"; }
146         function ignoresrm { ignores "$@" | xargs rm -f; }
147         function ignoresall { ignores -o -name "*.rej" "$@"; }
148         function ignoresallrm { ignoresall "$@" | xargs rm -f; }
149         function disass { objdump -D --target=binary --architecture=i386:x86-64 "$@"; }
150         function disass32 { objdump -D --target=binary --architecture=i386 "$@"; }
151         function cal {(unset cal; ( cal -m "$@"; ); );}
152         function vncreadonly { vncviewer -FullColor -Shared -ViewOnly "$@"; }
153         function diff {(unset diff; ( diff -dup "$@"; ); );}
154         $(: MAKEFLAGS= - "make install" does not expect -j and .spec files do not force -j1.)
155         function rpmbuildlocal { MAKEFLAGS= n rpmbuild --define "_topdir $PWD" --define "_builddir $PWD" --define "_rpmdir $PWD" --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_srcrpmdir $PWD" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" "$@"; rmdir &>/dev/null BUILDROOT; }
156         function gdbn { gdb -nx --command=~/.gdbinit "$@"; }
157         function hd { od -Ax -tx1; }
158         function wget {(unset wget; ( wget --no-check-certificate "$@"; ); );}
159 '
160
161 export IGNOREEOF=10
162 # '2>/dev/null' to prevent: TMOUT: readonly variable
163 [ -n "$SSH_TTY" ] && export TMOUT=900 2>/dev/null
164 export EDITOR='vim'
165 [ -x /bin/less ] && export PAGER='/bin/less -MMh5cis'
166 export PERL_MM_OPT=""
167 [ "$UID" -ne 0 ] && export PERL_MM_OPT="$PERL_MM_OPT PREFIX=$HOME"
168 for file in $HOME/.bookmarks.html;do
169         export WWW_HOME="file://$HOME/"
170         [ -r $file ] && export WWW_HOME="file://$file"
171         done
172 export GREP_OPTIONS="--binary-files=without-match --directories=skip"
173 if echo x|GREP_OPTIONS="--exclude=y" grep -q x 2>/dev/null;then
174         export GREP_OPTIONS="$GREP_OPTIONS --exclude=tags --exclude=TAGS --exclude=ChangeLog* --exclude=*.svn-base --exclude=*~"
175         # FIXME: grep(1) ignores subdirectories for --exclude.
176         #export GREP_OPTIONS="$GREP_OPTIONS --exclude=testsuite --exclude=.pc --exclude=.svn --exclude=CVS --exclude=po"
177 fi
178 if [ -n "$PS1" ];then   # set only in interactive sessions
179         if [ ! -f /MOCK ];then
180                 export PS1='[bash]${LOGNAME}@${HOSTNAME}:${PWD}# '
181         else
182                 export PS1='[bash]${LOGNAME}@MOCK-'"`cat /MOCK`"':${PWD}# '
183         fi
184         export PS1='\[\017\]'"$PS1"     # \017=std charmap
185         export PS1='\[\033%G\]'"$PS1"   # \033%G=utf-8
186         # Do not: kbd_mode -u # utf-8
187         # as it breaks keyboard state in X and it is not permitted for non-root.
188 fi
189 export MINICOM="-m -c on"       # metakeys+color
190 export HISTSIZE=100000
191 export HISTFILESIZE="$HISTSIZE"
192 export GDBHISTFILE="$HOME/.gdb_history"
193 export CVS_RSH="ssh"
194 export TZ=":/usr/share/zoneinfo/Europe/Prague"
195 #export TZ=":/usr/share/zoneinfo/Canada/Eastern"
196 export PYTHONUNBUFFERED=1
197 export MAKEFLAGS=
198 cpus="`getconf _NPROCESSORS_ONLN`"
199 if [ -n "$cpus" ];then
200         MAKEFLAGS="$MAKEFLAGS -j$[$cpus*3/2]"
201 fi
202 unset cpus
203 # Do not: grep -w "$TERM" /etc/termcap >/dev/null || export TERM=vt220
204 # as Sun workaround as Debian misses: /etc/termcap
205 # expects: $uname_p
206 [ "$TERM" = vt220 -a "${uname_p%86}" != "$uname_p" ] && export TERM=linux
207 if grep 2>/dev/null -q '^..............:0C38 00000000:0000 0A ' /proc/net/tcp \
208 || grep 2>/dev/null -q '^....: 00000000000000000000000000000000:0C38 00000000000000000000000000000000:0000 0A ' /proc/net/tcp6 \
209 ;then
210         export  http_proxy=http://127.0.0.1:3128/
211         export https_proxy=http://127.0.0.1:3128/
212         export   ftp_proxy=http://127.0.0.1:3128/
213 fi
214 _selfabs=
215 [ "$_selfabs" = "${_selfabs#/}" ] && _selfabs="$BASH_SOURCE"
216 [ "$_selfabs" = "${_selfabs#/}" ] && _selfabs="$PWD/.bashrc"
217 [ -r "$_selfabs" ] || unset _selfabs
218 [ -n "$_selfabs" ] && export VIMINIT="source `echo "$_selfabs"|sed 's/[.]bashrc$/.vimrc/'`"
219
220 # Force English.
221 unset LANG LANGUAGE `set|sed -n 's/^\(LC_[^=]*\)=.*$/\1/p'`
222 export LANG=en_US.UTF-8
223 # Force strcoll() to sort case-sensitively! (empty/undef doesn't work)
224 export LC_COLLATE=C
225 # Do not: # Prevent: perl: warning: Setting locale failed.
226 #         # due to LC_COLLATE=C and LC_ALL=(unset)
227 #         export LC_ALL=C
228 # as it breaks Mutt "utf-8" and somehow it is no longer needed.
229 # Re: [Bug-readline] Readline 6.0 patch 004 trapped signal echoed to conso
230 # http://lists.gnu.org/archive/html/bug-readline/2009-09/msg00006.html
231 # 2>/dev/null for possible: stty: standard input: Inappropriate ioctl for device
232 stty -echoctl 2>/dev/null
233
234 function wclines { awk '{x[$0]++}END{for (i in x) print x[i]"\t"i}'; }
235 # SunOS does not support "-m"
236 export ULIMITME_OPTS=""
237 for i in "-m 100000" "-d 150000" "-v 200000";do
238         (ulimit $i 2>/dev/null) && ULIMITME_OPTS="$ULIMITME_OPTS $i"
239         done
240 # Prevent: ulimit:  -m 100000 -d 150000 -v 200000: invalid number
241 # by forcing our known $IFS value; eval(1) is needed to take $IFS to effect:
242 function ulimitme { IFS=" " eval "ulimit $ULIMITME_OPTS"; }
243 function finame { find . -false `
244         awk </dev/null 'BEGIN{ for (i=1;i<ARGC;i++) print " -o -iname *"ARGV[i]"*"; }' "$@"
245         `; }
246 function mkcd { mkdir -p "$1"; cd "$1"; }
247 function pushdmk { mkdir -p "$1"; pushd "$1"; }
248 function rsync {(unset rsync; n rsync -a -v -e ssh --progress --stats --inplace --rsync-path='nice -n20 ionice -c3 rsync' "$@"; );}
249 function tohex { od -An -txC|tr -d '\n '|tr 'a-f' 'A-F';echo; }
250 function edall {
251         find -type f|while read -r i;do
252                 (awk </dev/null 'BEGIN{ for (i=1;i<ARGC;i++) print ARGV[i]; }' "$@";echo -e 'w\nq')|ed -s "$i"
253                 done
254         }
255 function mi { (
256         set -ex;cd "$1";while true;do test "$PWD" != "/";if [ -e configure.in -o -e Makefile.PL ];then break;fi;cd ..;done;make install
257         ); }
258 function ctags {(unset ctags
259         if [ $# -ne 0 -a '(' $# -ne 1 -o "$1" '!=' "--c-types=+px" ')' ];then ctags "$@";else
260                 find -name testsuite -prune -o -name gdbserver -prune -o -name .pc -prune -o -name .svn -prune -o \
261                                 -type f -a '!' -name tags -a '!' -name TAGS -a '(' -false \
262                                                 -o -name "*.[chCy]" \
263                                                 -o -name "*.cc"    \
264                                                 -o -name "*.cxx"   \
265                                                 -o -name "*.cpp"   \
266                                                 -o -name "*.[Ss]"  \
267                                                 -o -name "*.java"  \
268                                                 -o -name "*.p[lm]" \
269                                                 -o -name "*.py" \
270                                                 -o -name "*.exp" \
271                                                 ')' \
272                                 |ctags --file-tags -L - --langmap=Tcl:+.exp "$@"
273         fi; );}
274 function ctagsh { ctags "--c-types=+px"; }
275 function cpan {(unset cpan; if [ $# = 0 ];then cpan;else perl -MCPAN -e "install qw($*);";fi; );}
276 function exx { cd "`unset exx;exx "$@"|tee /proc/self/fd/2|tail -n1|sed -n 's/^extdir=//p'`"; }
277 function debuginfo { if test -n "$*";then echo "$*";else cat;fi \
278         |xargs rpm -qf|xargs rpmquery --qf '%{SOURCERPM}\n'|sed 's/-[^-]*-[^-]*[.]src[.]rpm$/-debuginfo/'|sort -u; }
279 function ipcsrmall { ipcs|awk '/- Shared Memory/{x="-m"}/- Semaphore/{x="-s"}/^0x/{print "ipcrm "x" "$2}'; }
280 function eog {(unset eog; touch /tmp/eog.$$;eog "$@" {,,,,,,,,,}/tmp/eog.$$;rm -f /tmp/eog.$$; );}
281 function diffc { diff -dup "$@"|grep -v '^\(Only in \|Binary files\)'; }
282 function diffi { diffc -X ~/.diffi.list "$@" | diffdecvs; }
283 function cvs {(unset cvs
284         local _opts _opts_d _now _line _o
285         _opts_d="-d"
286         if grep -iw '\(sources.redhat.com\|sourceware.org\):/cvs/src' CVS/Root &>/dev/null;then _opts_d="";fi
287         if grep -iw '\(cvs.fedoraproject.org\):/cvs/pkgs' CVS/Root &>/dev/null;then _opts_d="";fi
288         if grep '^tests/kernel/syscalls/ptrace' CVS/Repository &>/dev/null;then _opts_d="";fi
289         _now=false
290         _line=""
291         _opts=""
292         while [ $# != 0 ];do
293                 _o="$1"
294                 shift
295                 _line="$_line $_o"
296                 if [ "$_o" = "--" ] && ! $_now;then _now=true;continue;fi
297                 if [ "${_o#-}" != "$_o" ] && ! $_now;then continue;fi
298                 if [ "$_o" = update -o "$_o" = upd -o "$_o" = up ];then _opts="$_opts_d";fi
299                 break
300                 done
301         cvs $_line $_opts "$@"
302         ); }
303 function perlrpm { repoquery -q --whatprovides $(for i in "$@";do echo "perl($i)";done|sed -e 's/\//::/g' -e 's/[.]pm//g'); }
304 # `-u' limits the search to $UID.
305 function pidof
306 {(unset pidof
307   if [ "$1" = "-u" ];then
308     shift
309     local r="$(pidof "$@")"
310     local space=""
311     local p
312     for p in $r;do
313       if grep -q "$(echo -e "^Uid:\t$UID\t")" "/proc/$p/status";then
314         echo -n "${space}$p"
315         space=" "
316       fi
317     done
318     echo
319   else
320     pidof "$@"
321   fi
322 )}
323 function sumlog { find "$@" ! -name config.log -name "*.log" -o -name "*.sum"; }
324 function sourcewarecvscheckout {(set -ex
325         ! test -d src
326         ! test -d $1-cvs 
327         (set +x;cvs -z3 -d :pserver:anoncvs:@sourceware.org:/cvs/src checkout $1)
328         mv src $1-cvs
329         cd $1-cvs
330         (set +x;cvs update)
331         #(set +x;cvsignoresall)
332         (set +x;ignoresall)
333         );}
334 function gdbgitclone { git clone git://sourceware.org/git/gdb.git gdb-git; }
335 function binutilsgitclone { git clone git://sourceware.org/git/binutils.git binutils-git; }
336 function gdbcvscheckout { sourcewarecvscheckout gdb; }
337 function binutilscvscheckout { sourcewarecvscheckout binutils; }
338 function uri_escape   { perl -MURI::Escape -le '$_=<>;chomp;print uri_escape   $_;'; };
339 function uri_unescape { perl -MURI::Escape -le '$_=<>;chomp;print uri_unescape $_;'; };
340 alias fetchmail='n fetchmail'
341 function rpmsrclist
342 {
343         if [ -z "$*" ]; then
344                 echo >&2 "rpmsrclist gcc-4.3.2-7 [4.4.0-0.25 [-|http://kojipkgs.fedoraproject.org/packages/gcc/4.4.0/0.25/]]"
345         else
346                 rpm -q --qf '%{SOURCERPM} %{name}-%{version}-%{release}.%{arch}\n' -a \
347                         | grep "^$1.src.rpm " | sed 's/^[^ ]* //' \
348                         | \
349                                 if [ -z "$2" ]; then \
350                                         cat; \
351                                 else \
352                                         sed "s/-$(echo "$1"|sed 's/^.*-\([^-]*-[^-]*\)$/\1/')/-$2/"
353                                 fi \
354                         | \
355                                 if [ -z "$3" ]; then \
356                                         cat; \
357                                 else \
358                                         if [ "$3" != - ]; then
359                                                 sed "s#.*#$3&.rpm#"; \
360                                         else \
361                                                 base="$(echo "$1"|sed 's/^\(.*\)-[^-]*-[^-]*$/\1/')"; \
362                                                 sed "s#^.*-\([^-]*\)-\([^-]*\)\.\([^.]*\)\$#http://kojipkgs.fedoraproject.org/packages/$base/\1/\2/\3/&.rpm#"; \
363                                         fi; \
364                                 fi \
365                         | sort -u
366         fi
367 }
368 function valgrind {(set -e;unset valgrind;s=~/.python.valgrind;rm -f $s;cp -p /usr/share/doc/python-devel-2.*/valgrind-python.supp $s;patch $s <$s.patch;perl -i -e 'undef $/;$_=<>;1 while s/^(?:###)?({\n)(?:###)?( *ADDRESS_IN_RANGE.*\n(?:[^}#].*\n)*)###/$1$2/gm;print;' $s;valgrind --num-callers=50 --suppressions=$s "$@";);}
369 function yumupdate {(ulimit -v unlimited;yum makecache;yum -y --skip-broken update "$@";);}
370 function gitcommit { git commit -a -m .; }
371 function gpg {(unset gpg; http_proxy= all_proxy= HTTP_PROXY= ALL_PROXY= gpg "$@"; );}
372
373 ulimit -S -c 0
374 set +H
375 shopt -s mailwarn
376 unset OPTIND
377 umask 022
378
379 if [ -f "$HOME/.bashrc.local" ];then source "$HOME/.bashrc.local";fi
380
381 # Interactive part:
382 for key in $HOME/.ssh/id_dsa;do
383
384         # DISABLED now.
385         continue
386
387         [ -r "$key" ] || continue
388         # Do not: [ -n "$SSH_TTY" ] && continue
389         # as we may want foreign SSH keys too.
390
391         agenteval=/tmp/.$USER.ssh-agent.eval
392         if lockfile -1 -r 3 -l 10 -s 1 $agenteval.lock;then
393                 test -f $agenteval -a -O $agenteval -a -G $agenteval &&
394                                 # ">/dev/null" to prevent: echo Agent pid 31074
395                                 source $agenteval >/dev/null
396                 if [ "ssh-agent" != "`(xargs -0 </proc/"$SSH_AGENT_PID"/cmdline sh -c 'echo "$0"') 2>/dev/null `" ];then
397                         rm -f $agenteval
398                         (test ! -e $agenteval && ssh-agent -s >$agenteval) || echo >&2 'Failing ssh-agent!'
399                         # ">/dev/null" to prevent: echo Agent pid 31074
400                         source $agenteval >/dev/null
401                 fi
402                 rm -f $agenteval.lock
403         fi
404
405         # Prevent gdm(8) lockups on non-interactive consoles.
406         tty -s || continue
407         (ssh-add -l|grep -qw "$key") && continue
408         if lockfile -! -1 -r 0 $agenteval.input.lock 2>/dev/null;then
409                 echo >&2 -n "Locking: $agenteval.input.lock ... "
410                 lockfile -1 -r -1 $agenteval.input.lock
411                 echo >&2 "locked"
412         fi
413         # Recheck identity existence after the lock acquire
414         if ssh-add -l|grep -qw "$key";then
415                 echo >&2 "Identity $key already appended in the meantime."
416         else
417                 # "2>/dev/null" to prevent: Identity added: .ssh/id_dsa (.ssh/id_dsa)
418                 ssh-add "$key" 2>/dev/null
419         fi
420         rm -f $agenteval.input.lock
421         echo >&2 "$agenteval.input.lock unlocked."
422 done
423 unset agenteval
424
425         unset _home_short_dotbashrc     # permit later reinitializations
426 fi      # _home_short_dotbashrc
427
428 true    # Prevent crash in '-e' mode