22 [ "`type -t ls`" = alias ] && unalias ls
23 [ "`type -t ll`" = alias ] && unalias ll
24 [ "`type -t mc`" = alias ] && unalias mc
26 back() { cd - ${1:+"$@"}; }
27 clo() { clear; logout; }
28 eval 'functions() { typeset -f ${1:+"$@"}; }'
31 if [ -z "$BASH_COMPLETION_COMPAT_DIR" ]; then
32 if [ "$SHELL" = /bin/bash ]; then
33 if [ -f /etc/bash_completion ]; then
34 . /etc/bash_completion
35 elif [ -d /etc/bash_completion.d ]; then
36 . /etc/bash_completion.d/*
38 elif [ "$SHELL" = /usr/local/bin/bash ]; then
39 if [ -d /usr/local/etc/bash_completion.d ]; then
40 . /usr/local/etc/bash_completion.d/*
43 echo "Unknown OS type, canot source bash_completion" >&2
47 has_completion() { return 0; }
48 if [ "$SHELL" = /bin/bash ]; then
49 if [ -d /etc/bash_completion.d -o -d /usr/share/bash-completion/completions ]; then
50 has_completion() { [ -r /etc/bash_completion.d/$1 -o -r /usr/share/bash-completion/completions/$1 ]; }
52 elif [ "$SHELL" = /usr/local/bin/bash ]; then
53 if [ -d /usr/local/etc/bash_completion.d ]; then
54 has_completion() { [ -r /usr/local/etc/bash_completion.d/$1 ]; }
58 for cmd in builtin cgmem_nice command dbus-launch exec \
59 killall man nice nohup pidof pidOf KillAll pgrep pkill psg pswg su sudo \
60 time whence whereis which xargs; do
61 ! has_completion $cmd && complete -o default -A command $cmd
64 for cmd in dig host nslookup nc netcat nmap p ping ping6 socat \
66 tcptraceroute tcptraceroute6 tracert tracert6 traceroute traceroute6 \
67 whois wget wget-m wget-wrapper ww; do
68 ! has_completion $cmd && complete -A hostname $cmd
71 for cmd in distribute ftp lftp r rsync \
72 s scp ssh smbclient tcpdump tshark wireshark; do
73 ! has_completion $cmd && complete -o default -A hostname $cmd;
76 complete -A job bg fg j jobs wait
77 complete -A variable unset
79 if [ -d "$HOME/lib/config" ]; then
80 complete -W "`cd \"$HOME/lib/config\" && echo *`" include
82 complete -W "`echo $BROWSER | sed 's/:/ /g'`" start-browser
86 back() { cd - ${1:+"$@"}; }
87 clo() { clear; exit; }
92 clo() { clear; exit; }
97 # clear history, clear screen and logout
98 #chlo() { cd; unset HISTFILE; rm -f .*history*; clo; }
101 #Pwd() { pwd | sed "s/.*\/\(.*\)\/\(.*\)\/\(.*\)\/\(.*\)/...\/\2\/\3\/\4/"; }
102 #PWd() { pwd | sed "s/.*\/\(.*\)\/\(.*\)/...\/\2/"; }
105 psg() { ps auxw | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\)'; }
106 pswg() { ps auxwww | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\)'; }
109 pidOf() { ps auxwww | grep -i ${1:+"$@"} | grep -v '\(ps auxw\|grep\|pidOf\|KillAll\)' | awk '{print $2}'; }
111 # A kind of pkill/killall
116 kill "$1" `pidOf "$2"`
122 X() { startx >> .Xserver.log 2>&1; cyr; }
126 LESS=FRSX"$LESS" command git "$@"
132 if [ -f "./$cfg" -a -r "./$cfg" ]; then
133 echo "Reading config file \`$cfg'" 1>&2
135 elif [ -f "$HOME/lib/config/$cfg" -a -r "$HOME/lib/config/$cfg" ]; then
136 echo "Reading config file \`$HOME/lib/config/$cfg'" 1>&2
137 . "$HOME/lib/config/$cfg"
139 echo "Cannot find config file \`$cfg'" 1>&2
147 if [ -n "$SLOWTERM" ]; then
152 screen*) # screen, screen.rxvt
153 if [ "$TERM" = screen.rxvt ]; then
167 /usr/local/share/mc/bin/mc-wrapper.sh \
168 /usr/local/libexec/mc/mc-wrapper.sh \
169 /usr/share/mc/bin/mc-wrapper.sh; do
170 if [ -r $wrapper ]; then
171 . $wrapper $MC_SLOW $MC_XTERM "$@"
178 if [ $MC_FOUND = NO ]; then
179 for mc in /usr/local/bin/mc /usr/bin/mc; do
181 MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER"
182 if [ ! -d MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" ]; then
183 MC_TMP_DIR="${TMPDIR-/tmp}"
185 MC_PWD_FILE="$MC_TMP_DIR/mc.pwd.$$"
186 mc_type="`mc_type.py $mc`"
187 if [ "$mc_type" = old ]; then
188 $mc -P $MC_SLOW $MC_XTERM "$@" > "$MC_PWD_FILE"
189 elif [ "$mc_type" = new ]; then
190 $mc -P "$MC_PWD_FILE" $MC_SLOW $MC_XTERM "$@"
196 cd "`cat \"$MC_PWD_FILE\"`" && /bin/rm "$MC_PWD_FILE"
202 if [ $MC_FOUND = NO ]; then
203 echo "Cannot find mc-wrapper.sh or mc" >&2
207 [ -n "$MC_SAVE_TERM" ] && TERM="$MC_SAVE_TERM"
208 unset MC_FOUND MC_PWD_FILE MC_SAVE_TERM MC_SLOW MC_TMP_DIR MC_XTERM
214 if [ $# -ne 1 ]; then
215 echo "Usage: mkcd directory_name" >&2
216 elif [ -d "$1" ]; then
218 elif [ -e "$1" ]; then
219 echo "Error: $1 is a file" >&2
221 mkdir -p "$1" && cd "$1"
229 TERM=rxvt-unicode command tmux "$@"