11 [ "`type -t ls`" = alias ] && unalias ls
12 [ "`type -t ll`" = alias ] && unalias ll
13 [ "`type -t mc`" = alias ] && unalias mc
15 back() { cd - ${1:+"$@"}; }
16 clo() { clear; logout; }
17 eval 'functions() { typeset -f ${1:+"$@"}; }'
20 if [ -z "$BASH_COMPLETION_COMPAT_DIR" ]; then
21 if [ "$SHELL" = /bin/bash ]; then
22 if [ -f /etc/bash_completion ]; then
23 . /etc/bash_completion
24 elif [ -d /etc/bash_completion.d ]; then
25 . /etc/bash_completion.d/*
27 elif [ "$SHELL" = /usr/local/bin/bash ]; then
28 if [ -d /usr/local/etc/bash_completion.d ]; then
29 . /usr/local/etc/bash_completion.d/*
32 echo "Unknown OS type, canot source bash_completion" >&2
36 has_completion() { return 0; }
37 if [ "$SHELL" = /bin/bash ]; then
38 if [ -d /etc/bash_completion.d -o -d /usr/share/bash-completion/completions ]; then
39 has_completion() { [ -r /etc/bash_completion.d/$1 -o -r /usr/share/bash-completion/completions/$1 ]; }
41 elif [ "$SHELL" = /usr/local/bin/bash ]; then
42 if [ -d /usr/local/etc/bash_completion.d ]; then
43 has_completion() { [ -r /usr/local/etc/bash_completion.d/$1 ]; }
47 for cmd in builtin cgmem_nice command dbus-launch exec \
48 killall man nice nohup pidof pidOf KillAll pgrep pkill psg pswg su sudo \
49 time whence whereis which xargs; do
50 ! has_completion $cmd && complete -o default -A command $cmd
53 for cmd in dig host nslookup nc netcat nmap p ping ping6 socat \
55 tcptraceroute tcptraceroute6 tracert tracert6 traceroute traceroute6 \
56 whois wget wget-m wget-wrapper ww; do
57 ! has_completion $cmd && complete -A hostname $cmd
60 for cmd in distribute ftp lftp r rsync \
61 s scp ssh smbclient tcpdump tshark wireshark; do
62 ! has_completion $cmd && complete -o default -A hostname $cmd;
65 complete -A job bg fg j jobs wait
66 complete -A variable unset
68 if [ -d "$HOME/lib/config" ]; then
69 complete -W "`cd \"$HOME/lib/config\" && echo *`" include
71 complete -W "`echo $BROWSER | sed 's/:/ /g'`" start-browser
75 back() { cd - ${1:+"$@"}; }
76 clo() { clear; exit; }
81 clo() { clear; exit; }
86 # clear history, clear screen and logout
87 #chlo() { cd; unset HISTFILE; rm -f .*history*; clo; }
90 #Pwd() { pwd | sed "s/.*\/\(.*\)\/\(.*\)\/\(.*\)\/\(.*\)/...\/\2\/\3\/\4/"; }
91 #PWd() { pwd | sed "s/.*\/\(.*\)\/\(.*\)/...\/\2/"; }
94 psg() { ps auxw | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\)'; }
95 pswg() { ps auxwww | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\)'; }
98 pidOf() { ps auxwww | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\|pidOf\|KillAll\)' | awk '{print $2}'; }
100 # A kind of pkill/killall
105 kill "$1" `pidOf "$2"`
111 X() { startx >> .Xserver.log 2>&1; cyr; }
117 if [ -f "./$cfg" -a -r "./$cfg" ]; then
118 echo "Reading config file \`$cfg'" 1>&2
120 elif [ -f "$HOME/lib/config/$cfg" -a -r "$HOME/lib/config/$cfg" ]; then
121 echo "Reading config file \`$HOME/lib/config/$cfg'" 1>&2
122 . "$HOME/lib/config/$cfg"
124 echo "Cannot find config file \`$cfg'" 1>&2
130 if [ -n "$SLOWTERM" ]; then
135 screen*) # screen, screen.rxvt
136 if [ "$TERM" = screen.rxvt ]; then
150 /usr/local/share/mc/bin/mc-wrapper.sh \
151 /usr/local/libexec/mc/mc-wrapper.sh \
152 /usr/share/mc/bin/mc-wrapper.sh; do
153 if [ -r $wrapper ]; then
154 . $wrapper $MC_SLOW $MC_XTERM "$@"
161 if [ $MC_FOUND = NO ]; then
162 for mc in /usr/local/bin/mc /usr/bin/mc; do
164 MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER"
165 if [ ! -d MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" ]; then
166 MC_TMP_DIR="${TMPDIR-/tmp}"
168 MC_PWD_FILE="$MC_TMP_DIR/mc.pwd.$$"
169 mc_type="`mc_type.py $mc`"
170 if [ "$mc_type" = old ]; then
171 $mc -P $MC_SLOW $MC_XTERM "$@" > "$MC_PWD_FILE"
172 elif [ "$mc_type" = new ]; then
173 $mc -P "$MC_PWD_FILE" $MC_SLOW $MC_XTERM "$@"
179 cd "`cat \"$MC_PWD_FILE\"`" && /bin/rm "$MC_PWD_FILE"
185 if [ $MC_FOUND = NO ]; then
186 echo "Cannot find mc-wrapper.sh or mc" >&2
190 [ -n "$MC_SAVE_TERM" ] && TERM="$MC_SAVE_TERM"
191 unset MC_FOUND MC_PWD_FILE MC_SAVE_TERM MC_SLOW MC_TMP_DIR MC_XTERM
199 TMUX_SAVE_TERM="$TERM"
207 [ -n "$TMUX_SAVE_TERM" ] && TERM="$TMUX_SAVE_TERM"