11 home_link="`readlink /home`"
12 if [ -n "$home_link" ]; then
23 [ "`type -t ls`" = alias ] && unalias ls
24 [ "`type -t ll`" = alias ] && unalias ll
25 [ "`type -t mc`" = alias ] && unalias mc
27 back() { cd - ${1:+"$@"}; }
28 clo() { clear; logout; }
29 eval 'functions() { typeset -f ${1:+"$@"}; }'
32 if [ -z "$BASH_COMPLETION_COMPAT_DIR" ]; then
33 if [ "$SHELL" = /bin/bash ]; then
34 if [ -f /etc/bash_completion ]; then
35 . /etc/bash_completion
36 elif [ -d /etc/bash_completion.d ]; then
37 . /etc/bash_completion.d/*
39 elif [ "$SHELL" = /usr/local/bin/bash ]; then
40 if [ -d /usr/local/etc/bash_completion.d ]; then
41 . /usr/local/etc/bash_completion.d/*
44 echo "Unknown OS type, canot source bash_completion" >&2
48 has_completion() { return 0; }
49 if [ "$SHELL" = /bin/bash ]; then
50 if [ -d /etc/bash_completion.d -o -d /usr/share/bash-completion/completions ]; then
51 has_completion() { [ -r /etc/bash_completion.d/$1 -o -r /usr/share/bash-completion/completions/$1 ]; }
53 elif [ "$SHELL" = /usr/local/bin/bash ]; then
54 if [ -d /usr/local/etc/bash_completion.d ]; then
55 has_completion() { [ -r /usr/local/etc/bash_completion.d/$1 ]; }
59 for cmd in builtin cgmem_nice command dbus-launch exec \
60 killall man nice nohup pidof pidOf KillAll pgrep pkill psg pswg su sudo \
61 time whence whereis which xargs; do
62 ! has_completion $cmd && complete -o default -A command $cmd
65 for cmd in dig host nslookup nc netcat nmap p ping ping6 socat \
67 tcptraceroute tcptraceroute6 tracert tracert6 traceroute traceroute6 \
68 whois wget wget-m wget-wrapper ww; do
69 ! has_completion $cmd && complete -A hostname $cmd
72 for cmd in distribute ftp lftp r rsync \
73 s scp ssh smbclient tcpdump tshark wireshark; do
74 ! has_completion $cmd && complete -o default -A hostname $cmd;
77 complete -A job bg fg j jobs wait
78 complete -A variable unset
80 if [ -d "$HOME/lib/config" ]; then
81 complete -W "`cd \"$HOME/lib/config\" && echo *`" include
83 complete -W "`echo $BROWSER | sed 's/:/ /g'`" start-browser
87 back() { cd - ${1:+"$@"}; }
88 clo() { clear; exit; }
93 clo() { clear; exit; }
98 # clear history, clear screen and logout
99 #chlo() { cd; unset HISTFILE; rm -f .*history*; clo; }
102 #Pwd() { pwd | sed "s/.*\/\(.*\)\/\(.*\)\/\(.*\)\/\(.*\)/...\/\2\/\3\/\4/"; }
103 #PWd() { pwd | sed "s/.*\/\(.*\)\/\(.*\)/...\/\2/"; }
106 psg() { ps auxw | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\)'; }
107 pswg() { ps auxwww | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\)'; }
110 pidOf() { ps auxwww | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\|pidOf\|KillAll\)' | awk '{print $2}'; }
112 # A kind of pkill/killall
117 kill "$1" `pidOf "$2"`
123 X() { startx >> .Xserver.log 2>&1; cyr; }
129 if [ -f "./$cfg" -a -r "./$cfg" ]; then
130 echo "Reading config file \`$cfg'" 1>&2
132 elif [ -f "$HOME/lib/config/$cfg" -a -r "$HOME/lib/config/$cfg" ]; then
133 echo "Reading config file \`$HOME/lib/config/$cfg'" 1>&2
134 . "$HOME/lib/config/$cfg"
136 echo "Cannot find config file \`$cfg'" 1>&2
142 if [ -n "$SLOWTERM" ]; then
147 screen*) # screen, screen.rxvt
148 if [ "$TERM" = screen.rxvt ]; then
162 /usr/local/share/mc/bin/mc-wrapper.sh \
163 /usr/local/libexec/mc/mc-wrapper.sh \
164 /usr/share/mc/bin/mc-wrapper.sh; do
165 if [ -r $wrapper ]; then
166 . $wrapper $MC_SLOW $MC_XTERM "$@"
173 if [ $MC_FOUND = NO ]; then
174 for mc in /usr/local/bin/mc /usr/bin/mc; do
176 MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER"
177 if [ ! -d MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" ]; then
178 MC_TMP_DIR="${TMPDIR-/tmp}"
180 MC_PWD_FILE="$MC_TMP_DIR/mc.pwd.$$"
181 mc_type="`mc_type.py $mc`"
182 if [ "$mc_type" = old ]; then
183 $mc -P $MC_SLOW $MC_XTERM "$@" > "$MC_PWD_FILE"
184 elif [ "$mc_type" = new ]; then
185 $mc -P "$MC_PWD_FILE" $MC_SLOW $MC_XTERM "$@"
191 cd "`cat \"$MC_PWD_FILE\"`" && /bin/rm "$MC_PWD_FILE"
197 if [ $MC_FOUND = NO ]; then
198 echo "Cannot find mc-wrapper.sh or mc" >&2
202 [ -n "$MC_SAVE_TERM" ] && TERM="$MC_SAVE_TERM"
203 unset MC_FOUND MC_PWD_FILE MC_SAVE_TERM MC_SLOW MC_TMP_DIR MC_XTERM
211 TERM=rxvt-unicode command tmux "$@"