5 # If not running interactively, don't do anything
11 # Stop if non-interactive shell
12 [ -z "$PS1" ] && return
14 #if [ -x /usr/bin/dircolors ]; then
15 # # I don't like these aliases - they work only in command line
16 # # but not in scripts I run from command line.
17 # # Color parameters must be passed via environment.
18 # # So instead I put them in shell scripts in ~/bin.
19 # alias ls='ls --color=auto'
20 # alias dir='dir --color=auto'
21 # alias vdir='vdir --color=auto'
23 # alias grep='grep --color=auto'
24 # alias fgrep='fgrep --color=auto'
25 # alias egrep='egrep --color=auto'
27 # alias dmesg='dmesg --human'
42 if test -n "$KSH_VERSION" -o -n "$FCEDIT"; then
47 # clear screen and history, logout
48 chlo() { clear; cd; >$HISTFILE; unset HISTFILE; history -c; logout || exit; }
50 if [ -n "$STY" -a "$WINDOW" != 0 ]; then
51 #unset MAILCHECK everywhere except for the 1st GNU screen window
55 if test -x /usr/bin/git >/dev/null 2>&1; then
56 # chdir to a directory
59 echo "Usage: cdgitpath path_key" >&2
64 if [ -z "$path_key" ]; then
65 echo "Usage: cdgitpath path_key" >&2
69 path_url="`git config --get --path $path_key`"
70 if echo "$path_url" | grep -q '^file:/'; then
71 path_url="`echo \"$path_url\" | sed 's@^file:/\+@/@'`"
80 if [ -f "./$cfg" -a -r "./$cfg" ]; then
81 echo "Reading config file \`$cfg'" 1>&2
83 elif [ -f "$HOME/lib/config/$cfg" -a -r "$HOME/lib/config/$cfg" ]; then
84 echo "Reading config file \`$HOME/lib/config/$cfg'" 1>&2
85 . "$HOME/lib/config/$cfg" "$@"
87 echo "Cannot find config file \`$cfg'" 1>&2
92 [ "`type -t mc`" = alias ] && unalias mc
94 if [ -n "$SLOWTERM" ]; then
99 screen*) # screen, screen.rxvt
110 /usr/local/share/mc/bin/mc-wrapper.sh \
111 /usr/local/libexec/mc/mc-wrapper.sh \
112 /usr/share/mc/bin/mc-wrapper.sh; do
113 if [ -r $wrapper ]; then
114 . $wrapper $MC_SLOW $MC_XTERM "$@"
121 if [ $MC_FOUND = NO ]; then
122 for mc in /usr/local/bin/mc /usr/bin/mc; do
124 MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER"
125 if [ ! -d MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" ]; then
126 MC_TMP_DIR="${TMPDIR-/tmp}"
128 MC_PWD_FILE="$MC_TMP_DIR/mc.pwd.$$"
129 mc_type="`mc_type.py $mc`"
130 if [ "$mc_type" = old ]; then
131 $mc -P $MC_SLOW $MC_XTERM "$@" > "$MC_PWD_FILE"
132 elif [ "$mc_type" = new ]; then
133 $mc -P "$MC_PWD_FILE" $MC_SLOW $MC_XTERM "$@"
139 cd "`cat \"$MC_PWD_FILE\"`" && /bin/rm "$MC_PWD_FILE"
145 if [ $MC_FOUND = NO ]; then
146 echo "Cannot find mc-wrapper.sh or mc" >&2
150 unset MC_FOUND MC_PWD_FILE MC_SLOW MC_TMP_DIR MC_XTERM
157 if [ $# -ne 1 ]; then
158 echo "Usage: mkcd directory_name" >&2
159 elif [ -d "$1" ]; then
161 elif [ -e "$1" ]; then
162 echo "Error: $1 is a file" >&2
164 mkdir -p "$1" && cd "$1"
169 if which tmux >/dev/null 2>&1; then
173 TERM=rxvt-unicode command tmux "$@"
187 cd "`cat \"$HOME/tmp/vim/cwd\"`" && /bin/rm "$HOME/tmp/vim/cwd" &&
192 if [ "$SHLVL" -eq 1 ] && which startx >/dev/null 2>&1; then
193 X() { startx >> .Xserver.log 2>&1; cyr; /bin/rm -f .Xauthority; }