From: Oleg Broytman Date: Sat, 10 Sep 2022 13:02:20 +0000 (+0300) Subject: shell: Fix indent (3 spaces -> 4) X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=ad40a489bb055d06200a47b11c933f9d27f7adfe;p=dotfiles.git shell: Fix indent (3 spaces -> 4) --- diff --git a/.bashrc b/.bashrc index a6f9e08..319e303 100644 --- a/.bashrc +++ b/.bashrc @@ -44,83 +44,83 @@ functions() { typeset -f "$@"; } j() { jobs; } if [ -z "$BASH_COMPLETION_COMPAT_DIR" ]; then - if [ -d /usr/share/bash-completion -a -r /usr/share/bash-completion/bash_completion ]; then - _BASH_COMPLETIONS_DIR=/usr/share/bash-completion/completions - . /usr/share/bash-completion/bash_completion - elif [ -r /etc/bash_completion ]; then - _BASH_COMPLETIONS_DIR=/etc/bash_completion.d - . /etc/bash_completion - elif [ -d /etc/bash_completion.d ]; then - _BASH_COMPLETIONS_DIR=/etc/bash_completion.d - for _compf in /etc/bash_completion.d/*; do - . $_compf - done - elif [ -d /usr/local/etc/bash_completion.d ]; then - _BASH_COMPLETIONS_DIR=/usr/local/etc/bash_completion.d - for _compf in /usr/local/etc/bash_completion.d/*; do - . $_compf - done - else - echo "Unknown OS type, cannot source bash_completion" >&2 - fi + if [ -d /usr/share/bash-completion -a -r /usr/share/bash-completion/bash_completion ]; then + _BASH_COMPLETIONS_DIR=/usr/share/bash-completion/completions + . /usr/share/bash-completion/bash_completion + elif [ -r /etc/bash_completion ]; then + _BASH_COMPLETIONS_DIR=/etc/bash_completion.d + . /etc/bash_completion + elif [ -d /etc/bash_completion.d ]; then + _BASH_COMPLETIONS_DIR=/etc/bash_completion.d + for _compf in /etc/bash_completion.d/*; do + . $_compf + done + elif [ -d /usr/local/etc/bash_completion.d ]; then + _BASH_COMPLETIONS_DIR=/usr/local/etc/bash_completion.d + for _compf in /usr/local/etc/bash_completion.d/*; do + . $_compf + done + else + echo "Unknown OS type, cannot source bash_completion" >&2 + fi fi has_completion() { - [ -n "$_BASH_COMPLETIONS_DIR" -a -d "$_BASH_COMPLETIONS_DIR" -a -r "$_BASH_COMPLETIONS_DIR/$1" ] || - complete -p $1 >/dev/null 2>&1 + [ -n "$_BASH_COMPLETIONS_DIR" -a -d "$_BASH_COMPLETIONS_DIR" -a -r "$_BASH_COMPLETIONS_DIR/$1" ] || + complete -p $1 >/dev/null 2>&1 } for cmd in builtin cgmem_nice command dbus-launch exec \ - killall man nice nohup pidof pidOf KillAll pgrep pkill psg pswg \ - run-hosts su sudo time whence whereis which xargs; do - ! has_completion $cmd && complete -o default -A command $cmd + killall man nice nohup pidof pidOf KillAll pgrep pkill psg pswg \ + run-hosts su sudo time whence whereis which xargs; do + ! has_completion $cmd && complete -o default -A command $cmd done for cmd in dig host mtr nslookup nc netcat nmap p ping ping6 \ - ssh2 s2 socat telnet t tt \ - tcptraceroute tcptraceroute6 tracert tracert6 traceroute traceroute6 \ - whois wd wget wget-download wget-m wget-wrapper ww; do - ! has_completion $cmd && complete -A hostname $cmd + ssh2 s2 socat telnet t tt \ + tcptraceroute tcptraceroute6 tracert tracert6 traceroute traceroute6 \ + whois wd wget wget-download wget-m wget-wrapper ww; do + ! has_completion $cmd && complete -A hostname $cmd done for cmd in distribute ftp lftp r rsync \ - s scp ssh smbclient tcpdump tshark wireshark; do - ! has_completion $cmd && complete -o default -A hostname $cmd + s scp ssh smbclient tcpdump tshark wireshark; do + ! has_completion $cmd && complete -o default -A hostname $cmd done for cmd in bg fg jobs; do - ! has_completion $cmd && complete -A job $cmd + ! has_completion $cmd && complete -A job $cmd done complete -A job j wait for cmd in unset; do - ! has_completion $cmd && complete -A function -A variable $cmd + ! has_completion $cmd && complete -A function -A variable $cmd done if [ -d "$HOME"/.bash_completion.d ]; then - for _compf in "$HOME"/.bash_completion.d/*; do - . $_compf - done + for _compf in "$HOME"/.bash_completion.d/*; do + . $_compf + done fi delegate_completion() { - local prog programs - prog=$1 - ! has_completion $prog && return - shift - programs="$@" - eval "_${prog}_completion_loader() { - _completion_loader $prog - if [ x"$DELEGARE_NOSPACE" = x1 ]; then - complete -o nospace -F _$prog $programs - else - complete -F _$prog $programs - fi - unset _${prog}_completion_loader - return 124 - }" - complete -F _${prog}_completion_loader $programs + local prog programs + prog=$1 + ! has_completion $prog && return + shift + programs="$@" + eval "_${prog}_completion_loader() { + _completion_loader $prog + if [ x"$DELEGARE_NOSPACE" = x1 ]; then + complete -o nospace -F _$prog $programs + else + complete -F _$prog $programs + fi + unset _${prog}_completion_loader + return 124 + }" + complete -F _${prog}_completion_loader $programs } delegate_completion make m @@ -133,23 +133,23 @@ delegate_completion wget wget-m wget-wrapper ww unset _BASH_COMPLETIONS_DIR has_completion delegate_completion if [ -d "$HOME/lib/config" ]; then - complete -W "`cd \"$HOME/lib/config\" && echo *`" include + complete -W "`cd \"$HOME/lib/config\" && echo *`" include fi complete -W "`echo $BROWSER | sed 's/:/ /g'`" start-browser if [ "`type -t short_curdir`" != function -a \ - -r "$HOME"/admin/prog/bash_prompt ]; then - . "$HOME"/admin/prog/bash_prompt + -r "$HOME"/admin/prog/bash_prompt ]; then + . "$HOME"/admin/prog/bash_prompt fi if type -p pip >/dev/null 2>&1 || type -p pip3 >/dev/null 2>&1; then - _pip_completion_loader() { - eval "`pip$PY_VER completion --bash`" - complete -F _pip_completion pip pip2 pip2.7 pip3 pip3.4 pip3.5 pip3.6 pip3.7 pip3.8 pip3.9 pip3.10 - unset _pip_completion_loader - return 124 - } - complete -F _pip_completion_loader pip pip2 pip2.7 pip3 pip3.4 pip3.5 pip3.6 pip3.7 pip3.8 pip3.9 pip3.10 + _pip_completion_loader() { + eval "`pip$PY_VER completion --bash`" + complete -F _pip_completion pip pip2 pip2.7 pip3 pip3.4 pip3.5 pip3.6 pip3.7 pip3.8 pip3.9 pip3.10 + unset _pip_completion_loader + return 124 + } + complete -F _pip_completion_loader pip pip2 pip2.7 pip3 pip3.4 pip3.5 pip3.6 pip3.7 pip3.8 pip3.9 pip3.10 fi #if which pyenv >/dev/null 2>&1; then @@ -160,7 +160,7 @@ fi . virtualenvwrapper_lazy.sh 2>/dev/null if [ -n "$VIRTUAL_ENV" ] && ! type deactivate >/dev/null 2>&1; then - . "$VIRTUAL_ENV/bin/activate" + . "$VIRTUAL_ENV/bin/activate" fi # Clean up python virtual environment on exit @@ -170,136 +170,136 @@ trap '[ "$VIRTUAL_ENV" ] && deactivate' EXIT if test -x /usr/bin/git >/dev/null 2>&1; then - # chdir to a directory - cdgitpath() { - if [ $# -ne 1 ]; then - echo "Usage: cdgitpath path_key" >&2 - return 1 - fi - - path_key="$1" - if [ -z "$path_key" ]; then - echo "Usage: cdgitpath path_key" >&2 - return 1 - fi - - path_url="`git config --get --path $path_key`" - if echo "$path_url" | grep -q '^file:/'; then - path_url="`echo \"$path_url\" | sed 's@^file:/\+@/@'`" - fi - cd "$path_url" - } - - # chdir to a remote's directory (if the remote is on the local FS) - cdremote() { - if [ $# -gt 1 ]; then - echo "Usage: cdremote [remote_name]" >&2 - return 1 - fi - - if [ -z "$1" ]; then - branch="`git rev-parse --abbrev-ref HEAD`" - remote="`git config --get branch.$branch.remote`" - else - remote="$1" - fi - - if [ -n "$remote" ] && git config --get remote.$remote.url | - grep -q '^\(file:/\|/\|\.\./\)'; then # (file:/ or / or ../ at the beginning) - cdgitpath remote.$remote.url - else - - if [ -n "$1" ]; then - echo "Cannot find directory for remote $1" >&2 + # chdir to a directory + cdgitpath() { + if [ $# -ne 1 ]; then + echo "Usage: cdgitpath path_key" >&2 + return 1 + fi + + path_key="$1" + if [ -z "$path_key" ]; then + echo "Usage: cdgitpath path_key" >&2 + return 1 + fi + + path_url="`git config --get --path $path_key`" + if echo "$path_url" | grep -q '^file:/'; then + path_url="`echo \"$path_url\" | sed 's@^file:/\+@/@'`" + fi + cd "$path_url" + } + + # chdir to a remote's directory (if the remote is on the local FS) + cdremote() { + if [ $# -gt 1 ]; then echo "Usage: cdremote [remote_name]" >&2 return 1 - fi - - if test -n "$BASH_VERSION"; then - _list_remotes '^\(file:/\|/\|\.\./\)' # (file:/ or / or ../ at the beginning) - if [ ${#GIT_REMOTES[*]} -eq 1 ]; then - remote=${GIT_REMOTES[0]} - unset GIT_REMOTES - cdgitpath remote.$remote.url + fi + + if [ -z "$1" ]; then + branch="`git rev-parse --abbrev-ref HEAD`" + remote="`git config --get branch.$branch.remote`" + else + remote="$1" + fi + + if [ -n "$remote" ] && git config --get remote.$remote.url | + grep -q '^\(file:/\|/\|\.\./\)'; then # (file:/ or / or ../ at the beginning) + cdgitpath remote.$remote.url + else + + if [ -n "$1" ]; then + echo "Cannot find directory for remote $1" >&2 + echo "Usage: cdremote [remote_name]" >&2 + return 1 + fi + + if test -n "$BASH_VERSION"; then + _list_remotes '^\(file:/\|/\|\.\./\)' # (file:/ or / or ../ at the beginning) + if [ ${#GIT_REMOTES[*]} -eq 1 ]; then + remote=${GIT_REMOTES[0]} + unset GIT_REMOTES + cdgitpath remote.$remote.url + else + unset GIT_REMOTES + echo "Cannot find directory for any remote" >&2 + echo "Usage: cdremote [remote_name]" >&2 + return 1 + fi else - unset GIT_REMOTES - echo "Cannot find directory for any remote" >&2 - echo "Usage: cdremote [remote_name]" >&2 - return 1 + echo "Cannot find directory for remote $1" >&2 + echo "Usage: cdremote [remote_name]" >&2 + return 1 fi - else - echo "Cannot find directory for remote $1" >&2 - echo "Usage: cdremote [remote_name]" >&2 - return 1 - fi - fi - } - - if test -n "$BASH_VERSION"; then - # completion for aliases in global .gitconfig - - # fixup rbi rbia rbiap rbip - do refs name completion - _git_fixup() { __gitcomp_nl "$(__git_refs)" ; } - _git_rbi() { __gitcomp_nl "$(__git_refs)" ; } - _git_rbia() { __gitcomp_nl "$(__git_refs)" ; } - _git_rbiap() { __gitcomp_nl "$(__git_refs)" ; } - _git_rbip() { __gitcomp_nl "$(__git_refs)" ; } - # - # push-to-all-remotes - do branch name completion - _git_push_to_all_remotes() { __gitcomp_nl "$(__git_heads)" ; } - - _cdgitpath_complete() { - local cur="${COMP_WORDS[COMP_CWORD]}" - COMPREPLY=(`compgen -W "$(__git_config_get_set_variables)" -- "$cur"`) - } - - _git_open() { - _cdgitpath_complete - } - - complete -F _cdgitpath_complete cdgitpath git-open - - # list remotes with URLs matching a regexp - _list_remotes() { - if [ $# -ne 1 ]; then - echo "Usage: _list_remotes remote_regexp" >&2 - return 1 - fi - declare -ag GIT_REMOTES=() - local remote - for remote in `git remote`; do - if git config --get remote.$remote.url | grep -q "$1"; then - GIT_REMOTES+=($remote) + fi + } + + if test -n "$BASH_VERSION"; then + # completion for aliases in global .gitconfig + + # fixup rbi rbia rbiap rbip - do refs name completion + _git_fixup() { __gitcomp_nl "$(__git_refs)" ; } + _git_rbi() { __gitcomp_nl "$(__git_refs)" ; } + _git_rbia() { __gitcomp_nl "$(__git_refs)" ; } + _git_rbiap() { __gitcomp_nl "$(__git_refs)" ; } + _git_rbip() { __gitcomp_nl "$(__git_refs)" ; } + # + # push-to-all-remotes - do branch name completion + _git_push_to_all_remotes() { __gitcomp_nl "$(__git_heads)" ; } + + _cdgitpath_complete() { + local cur="${COMP_WORDS[COMP_CWORD]}" + COMPREPLY=(`compgen -W "$(__git_config_get_set_variables)" -- "$cur"`) + } + + _git_open() { + _cdgitpath_complete + } + + complete -F _cdgitpath_complete cdgitpath git-open + + # list remotes with URLs matching a regexp + _list_remotes() { + if [ $# -ne 1 ]; then + echo "Usage: _list_remotes remote_regexp" >&2 + return 1 + fi + declare -ag GIT_REMOTES=() + local remote + for remote in `git remote`; do + if git config --get remote.$remote.url | grep -q "$1"; then + GIT_REMOTES+=($remote) + fi + done + } + + # completion for cdremote and git-open-remote - list remotes with a pattern + _list_remotes_completion() { + local cur="${COMP_WORDS[COMP_CWORD]}" + _list_remotes "$1" + COMPREPLY=(`compgen -W "${GIT_REMOTES[*]}" -- "$cur"`) + unset GIT_REMOTES + } + + # completion for cdremote - list remotes with directories as URLs + _cdremote_complete() { + _list_remotes_completion '^\(file:/\|/\|\.\./\)' # (file:/ or / or ../ at the beginning) + if [ ${#COMPREPLY[*]} -eq 0 ]; then + _list_remotes_completion . + fi + } + + complete -F _cdremote_complete cdremote + + # completion for git-open-remote - list remotes with http(s) URLs + _git_open_remote() { + _list_remotes_completion '^http\(s\)\?://' + if [ ${#COMPREPLY[*]} -eq 0 ]; then + _list_remotes_completion . fi - done - } - - # completion for cdremote and git-open-remote - list remotes with a pattern - _list_remotes_completion() { - local cur="${COMP_WORDS[COMP_CWORD]}" - _list_remotes "$1" - COMPREPLY=(`compgen -W "${GIT_REMOTES[*]}" -- "$cur"`) - unset GIT_REMOTES - } - - # completion for cdremote - list remotes with directories as URLs - _cdremote_complete() { - _list_remotes_completion '^\(file:/\|/\|\.\./\)' # (file:/ or / or ../ at the beginning) - if [ ${#COMPREPLY[*]} -eq 0 ]; then - _list_remotes_completion . - fi - } - - complete -F _cdremote_complete cdremote - - # completion for git-open-remote - list remotes with http(s) URLs - _git_open_remote() { - _list_remotes_completion '^http\(s\)\?://' - if [ ${#COMPREPLY[*]} -eq 0 ]; then - _list_remotes_completion . - fi - } - - complete -F _git_open_remote git-open-remote - fi + } + + complete -F _git_open_remote git-open-remote + fi fi diff --git a/.profile b/.profile index 4aa6cb3..6ede301 100644 --- a/.profile +++ b/.profile @@ -23,7 +23,7 @@ #fi if [ -z "$USER" ]; then - USER="$LOGNAME"; export USER + USER="$LOGNAME"; export USER fi # the default umask is set in /etc/profile; for setting the umask @@ -42,11 +42,11 @@ export PATH MANPATH # LD_LIBRARY_PATH LANG=C #LC_ALL=C case "$LC_CTYPE" in - *UTF-8) # LC_CTYPE is already set - ;; + *UTF-8) # LC_CTYPE is already set + ;; - *) LC_CTYPE=ru_RU.KOI8-R - ;; + *) LC_CTYPE=ru_RU.KOI8-R + ;; esac LC_COLLATE="$LC_CTYPE" #LANGUAGE="ru en" @@ -69,151 +69,162 @@ export ORGANIZATION # NNTPSERVER # Interactive only commands if [ -t 0 ] ; then - #if test -f .hushlogin && ! cmp -s .motd /etc/motd; then - # tee $HOME/.motd < /etc/motd - #fi - - if [ -z "$TERM" ]; then - eval `tset -Q -s -m 'network:?xterm'` - fi - - stty sane erase ^H - - if which less >/dev/null 2>&1; then - HAS_LESS=true - fi - - case "$TERM" in - linux) - # mutt, python and vim - BACKGROUND=DARK - export BACKGROUND - [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/dark_bg - ;; - - *rxvt*|screen*|*term*|vt100) - BACKGROUND=LIGHT - export BACKGROUND - [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg - ;; - esac - - if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - fi - - if [ -n "$HAS_LESS" ]; then - PAGER=less - LESS="Rgimq" - case "$LC_CTYPE" in - *UTF-8) LESSCHARSET=utf-8 - ;; - - *) LESSCHARSET=koi8-r - ;; - esac - #LESSCHARDEF=32c. - LESSEDIT='vim ?lt+%lt. -- %f' - export LESS LESSCHARSET LESSEDIT # LESSCHARDEF - - # make less more friendly for non-text input files, see lesspipe(1) - #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - - else - PAGER=more - fi - export PAGER - - EDITOR="$HOME"/.vim/vim.sh - FCEDIT="$EDITOR" - VISUAL="$EDITOR" - export EDITOR FCEDIT VISUAL - - HISTCONTROL=ignoreboth - HISTIGNORE='&: *:x:X:[bf]g' - HISTFILE="$HOME/.sh_history" - HISTFILESIZE=2000 - HISTSIZE=1000 - export HISTCONTROL HISTIGNORE HISTFILE HISTFILESIZE HISTSIZE - - # Used by bash/mc for hostname completion - HOSTFILE="$HOME"/lib/config/hosts - export HOSTFILE - - MAIL="/var/mail/$USER" - MAILPATH="$MAIL:$HOME/mail/admin:$HOME/mail/block:$HOME/mail/bulk" - if [ -d "$HOME"/mail/lists/ ]; then - MAILPATH="$MAILPATH:`echo $HOME/mail/lists/* | sed 's/ /:/g'`" - fi - export MAIL MAILPATH - - BROWSER="links2:links:elinks:w3m:lynx" - case "$TERM" in - *rxvt*|screen*|*term*|vt100) - BROWSER="l:$BROWSER" - ;; - esac - export BROWSER - - #all_proxy="http://localhost:3128" - #ftp_proxy="$all_proxy" - #gopher_proxy="$all_proxy" - #http_proxy="$all_proxy" - #https_proxy="$all_proxy" - auto_proxy="file:///home/phd/admin/WWW/Mozilla/mozilla.pac" - no_proxy="localhost,127.0.0.1" - #export all_proxy ftp_proxy http_proxy https_proxy auto_proxy no_proxy # gopher_proxy - export auto_proxy no_proxy - - ENV="$HOME/.shellrc" - export ENV - - # set variable identifying the chroot you work in (used in the prompt below) - if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot="`cat /etc/debian_chroot`" - fi - - if test -n "$BASH_VERSION"; then - . "$HOME/.bashrc" - else - PS1="${debian_chroot:+($debian_chroot)}`/usr/bin/whoami`@`/bin/hostname -s` > " - fi - - ### biff controls new mail notification - #biff n - ### mesg controls messages (write/talk) from other users - mesg n - # make mail(1) use a pager - crt=; export crt - - PYTHONSTARTUP="$HOME"/lib/python/init.py - export PYTHONSTARTUP - - name="Oleg Broytman" - email="phd@phdru.name" - - GIT_AUTHOR_NAME="$name" - GIT_AUTHOR_EMAIL="$email" - GIT_COMMITTER_NAME="$name" - GIT_COMMITTER_EMAIL="$email" - export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL - - HGUSER="$name <$email>" - export HGUSER - - unset name email - - #if which pyenv >/dev/null 2>&1; then - # PYENV_ROOT="$HOME/.pyenv" - # export PYENV_ROOT - # PATH="$PYENV_ROOT/bin:$PATH" - # eval "`pyenv init --path`" - #fi - - #SCREENDIR="$HOME"/tmp/screen - #export SCREENDIR - #mkdir -p "$SCREENDIR" - #chmod 700 "$SCREENDIR" + #if test -f .hushlogin && ! cmp -s .motd /etc/motd; then + # tee $HOME/.motd < /etc/motd + #fi + + if [ -z "$TERM" ]; then + eval `tset -Q -s -m 'network:?xterm'` + fi + + stty sane erase ^H + + if which less >/dev/null 2>&1; then + HAS_LESS=true + fi + + case "$TERM" in + linux) + # mutt, python and vim + BACKGROUND=DARK + export BACKGROUND + [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/dark_bg + ;; + + *rxvt*|screen*|*term*|vt100) + BACKGROUND=LIGHT + export BACKGROUND + [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg + ;; + esac + + if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + fi + + if [ -n "$HAS_LESS" ]; then + PAGER=less + LESS="Rgimq" + case "$LC_CTYPE" in + *UTF-8) LESSCHARSET=utf-8 + ;; + + *) LESSCHARSET=koi8-r + ;; + esac + #LESSCHARDEF=32c. + LESSEDIT='vim ?lt+%lt. -- %f' + export LESS LESSCHARSET LESSEDIT # LESSCHARDEF + + # make less more friendly for non-text input files, see lesspipe(1) + #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + + else + PAGER=more + fi + export PAGER + + EDITOR="$HOME"/.vim/vim.sh + FCEDIT="$EDITOR" + VISUAL="$EDITOR" + export EDITOR FCEDIT VISUAL + + HISTCONTROL=ignoreboth + HISTIGNORE='&: *:x:X:[bf]g' + HISTFILE="$HOME/.sh_history" + HISTFILESIZE=2000 + HISTSIZE=1000 + export HISTCONTROL HISTIGNORE HISTFILE HISTFILESIZE HISTSIZE + + # Used by bash/mc for hostname completion + HOSTFILE="$HOME"/lib/config/hosts + export HOSTFILE + + MAIL="/var/mail/$USER" + MAILPATH="$MAIL:$HOME/mail/admin:$HOME/mail/block:$HOME/mail/bulk" + for mbox in "$HOME/mail/aviel" "$HOME/mail/stcnet"; do + if [ -f "$mbox" ]; then + MAILPATH="$mbox:$MAILPATH" + fi + done + if [ -d "$HOME"/mail/lists/ ]; then + MAILPATH="$MAILPATH:`echo $HOME/mail/lists/* | sed 's/ /:/g'`" + fi + export MAIL MAILPATH + if [ "x$SET_MAILCHECK" != xYES ]; then + unset MAILCHECK + else + unset SET_MAILCHECK + fi + unset mbox + + BROWSER="links2:links:elinks:w3m:lynx" + case "$TERM" in + *rxvt*|screen*|*term*|vt100) + BROWSER="l:$BROWSER" + ;; + esac + export BROWSER + + #all_proxy="http://localhost:3128" + #ftp_proxy="$all_proxy" + #gopher_proxy="$all_proxy" + #http_proxy="$all_proxy" + #https_proxy="$all_proxy" + auto_proxy="file:///home/phd/admin/WWW/Mozilla/mozilla.pac" + no_proxy="localhost,127.0.0.1,192.168.,10.,aviel.ru,progtech.ru" + #export all_proxy ftp_proxy http_proxy https_proxy auto_proxy no_proxy # gopher_proxy + export auto_proxy no_proxy + + ENV="$HOME/.shellrc" + export ENV + + # set variable identifying the chroot you work in (used in the prompt below) + if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot="`cat /etc/debian_chroot`" + fi + + if test -n "$BASH_VERSION"; then + . "$HOME/.bashrc" + else + PS1="${debian_chroot:+($debian_chroot)}`/usr/bin/whoami`@`/bin/hostname -s` > " + fi + + ### biff controls new mail notification + #biff n + ### mesg controls messages (write/talk) from other users + mesg n + # make mail(1) use a pager + crt=; export crt + + PYTHONSTARTUP="$HOME"/lib/python/init.py + export PYTHONSTARTUP + + name="Oleg Broytman" + email="phd@phdru.name" + + GIT_AUTHOR_NAME="$name" + GIT_AUTHOR_EMAIL="$email" + GIT_COMMITTER_NAME="$name" + GIT_COMMITTER_EMAIL="$email" + export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL + + HGUSER="$name <$email>" + export HGUSER + + unset name email + + #if which pyenv >/dev/null 2>&1; then + # PYENV_ROOT="$HOME/.pyenv" + # export PYENV_ROOT + # PATH="$PYENV_ROOT/bin:$PATH" + # eval "`pyenv init --path`" + #fi + + #SCREENDIR="$HOME"/tmp/screen + #export SCREENDIR + #mkdir -p "$SCREENDIR" + #chmod 700 "$SCREENDIR" fi # No need to set DISPLAY - ssh sets DISPLAY and calls xauth @@ -221,39 +232,39 @@ fi #export DISPLAY if [ -n "$DISPLAY" ]; then - # mutt, python and vim - BACKGROUND=LIGHT - export BACKGROUND - [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg - - # BROWSERs - BROWSER="firefox:seamonkey:chromium:google-chrome:opera:xlinks2:$BROWSER" - - ### X Window System Configuration - #XAPPLRESDIR="$HOME/lib/X11/app-defaults/"; export XAPPLRESDIR - ### Old-style XNLSPATH - #XNLSPATH=/usr/X11R6/lib/X11/nls; export XNLSPATH - - # For GTK2/GLib to convert filenames between internal and locale encodings - G_FILENAME_ENCODING="@locale" - export G_FILENAME_ENCODING - #G_BROKEN_FILENAMES=1 - #export G_BROKEN_FILENAMES - - # X Input Method, for Multi key (Compose) to work - GTK_IM_MODULE=xim - QT_IM_MODULE=xim - export GTK_IM_MODULE QT_IM_MODULE - - # GTK2 anti-aliasing - GDK_USE_XFT=1 - export GDK_USE_XFT - - # nVidia OpenGL full scene anti-aliasing - #__GL_FSAA_MODE=4 - #export __GL_FSAA_MODE - - #xhost +local:root > /dev/null 2>&1 + # mutt, python and vim + BACKGROUND=LIGHT + export BACKGROUND + [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg + + # BROWSERs + BROWSER="firefox:seamonkey:chromium:google-chrome:opera:xlinks2:$BROWSER" + + ### X Window System Configuration + #XAPPLRESDIR="$HOME/lib/X11/app-defaults/"; export XAPPLRESDIR + ### Old-style XNLSPATH + #XNLSPATH=/usr/X11R6/lib/X11/nls; export XNLSPATH + + # For GTK2/GLib to convert filenames between internal and locale encodings + G_FILENAME_ENCODING="@locale" + export G_FILENAME_ENCODING + #G_BROKEN_FILENAMES=1 + #export G_BROKEN_FILENAMES + + # X Input Method, for Multi key (Compose) to work + GTK_IM_MODULE=xim + QT_IM_MODULE=xim + export GTK_IM_MODULE QT_IM_MODULE + + # GTK2 anti-aliasing + GDK_USE_XFT=1 + export GDK_USE_XFT + + # nVidia OpenGL full scene anti-aliasing + #__GL_FSAA_MODE=4 + #export __GL_FSAA_MODE + + #xhost +local:root > /dev/null 2>&1 fi [ -n "$HAS_LESS" ] && unset HAS_LESS @@ -271,11 +282,11 @@ fi # If SUN console, start the windows system # # if [ `tty` = /dev/console ] ; then -# if [ "$TERM" = sun -o "$TERM" = AT386 ] ; then +# if [ "$TERM" = sun -o "$TERM" = AT386 ] ; then # # if [ ${OPENWINHOME:-""} = "" ] ; then -# OPENWINHOME=/usr/openwin -# export OPENWINHOME +# OPENWINHOME=/usr/openwin +# export OPENWINHOME # fi # # echo "" @@ -284,8 +295,8 @@ fi # # "$OPENWINHOME"/bin/openwin # -# clear # get rid of annoying cursor rectangle -# #exit # logout after leaving windows system +# clear # get rid of annoying cursor rectangle +# #exit # logout after leaving windows system # -# fi +# fi # fi diff --git a/.shellrc b/.shellrc index d5d7ca3..892921c 100644 --- a/.shellrc +++ b/.shellrc @@ -29,29 +29,29 @@ esac case "$HOME" in - /home/*) - if [ -L /home ]; then - START_DIR="`pwd`" && - cd "$HOME" && - HOME="`pwd`" && - cd "$START_DIR" - fi - ;; + /home/*) + if [ -L /home ]; then + START_DIR="`pwd`" && + cd "$HOME" && + HOME="`pwd`" && + cd "$START_DIR" + fi + ;; esac if test -n "$KSH_VERSION" -o -n "$FCEDIT"; then - back() { cd - "$@"; } - j() { jobs; } + back() { cd - "$@"; } + j() { jobs; } fi if test -n "$BASH_VERSION"; then - if [ -r "$HOME"/admin/prog/bash_prompt ]; then - . "$HOME"/admin/prog/bash_prompt - set_prompt - unset set_prompt - else - PS1="${debian_chroot:+($debian_chroot)}\u@\h:\W \$SHLVL\\$ " - fi + if [ -r "$HOME"/admin/prog/bash_prompt ]; then + . "$HOME"/admin/prog/bash_prompt + set_prompt + unset set_prompt + else + PS1="${debian_chroot:+($debian_chroot)}\u@\h:\W \$SHLVL\\$ " + fi fi # clear screen and history, logout @@ -59,114 +59,114 @@ chlo() { clear; cd; >$HISTFILE; unset HISTFILE; history -c; logout || exit; } include() { - cfg="$1" - shift - if [ -f "./$cfg" -a -r "./$cfg" ]; then - echo "Reading config file \`$cfg'" 1>&2 - . "./$cfg" "$@" - elif [ -f "$HOME/lib/config/$cfg" -a -r "$HOME/lib/config/$cfg" ]; then - echo "Reading config file \`$HOME/lib/config/$cfg'" 1>&2 - . "$HOME/lib/config/$cfg" "$@" - else - echo "Cannot find config file \`$cfg'" 1>&2 - fi + cfg="$1" + shift + if [ -f "./$cfg" -a -r "./$cfg" ]; then + echo "Reading config file \`$cfg'" 1>&2 + . "./$cfg" "$@" + elif [ -f "$HOME/lib/config/$cfg" -a -r "$HOME/lib/config/$cfg" ]; then + echo "Reading config file \`$HOME/lib/config/$cfg'" 1>&2 + . "$HOME/lib/config/$cfg" "$@" + else + echo "Cannot find config file \`$cfg'" 1>&2 + fi } [ "`type -t mc`" = alias ] && unalias mc mc() { - if [ -n "$SLOWTERM" ]; then - MC_SLOW="--slow" - fi - - case "$TERM" in - screen*) # screen, screen.rxvt - MC_XTERM="-x" - ;; - esac - - #TMPDIR="$HOME"/tmp - #export TMPDIR - - MC_FOUND=NO - - for wrapper in \ - /usr/local/share/mc/bin/mc-wrapper.sh \ - /usr/local/libexec/mc/mc-wrapper.sh \ - /usr/share/mc/bin/mc-wrapper.sh; do - if [ -r $wrapper ]; then - . $wrapper $MC_SLOW $MC_XTERM "$@" - rc=$? - MC_FOUND=YES - break - fi - done - - if [ $MC_FOUND = NO ]; then - for mc in /usr/local/bin/mc /usr/bin/mc; do - if [ -x $mc ]; then - MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" - if [ ! -d MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" ]; then - MC_TMP_DIR="${TMPDIR-/tmp}" - fi - MC_PWD_FILE="$MC_TMP_DIR/mc.pwd.$$" - mc_type="`mc_type.py $mc`" - if [ "$mc_type" = old ]; then - $mc -P $MC_SLOW $MC_XTERM "$@" > "$MC_PWD_FILE" - elif [ "$mc_type" = new ]; then - $mc -P "$MC_PWD_FILE" $MC_SLOW $MC_XTERM "$@" - else - continue - fi + if [ -n "$SLOWTERM" ]; then + MC_SLOW="--slow" + fi + + case "$TERM" in + screen*) # screen, screen.rxvt + MC_XTERM="-x" + ;; + esac + + #TMPDIR="$HOME"/tmp + #export TMPDIR + + MC_FOUND=NO + + for wrapper in \ + /usr/local/share/mc/bin/mc-wrapper.sh \ + /usr/local/libexec/mc/mc-wrapper.sh \ + /usr/share/mc/bin/mc-wrapper.sh; do + if [ -r $wrapper ]; then + . $wrapper $MC_SLOW $MC_XTERM "$@" rc=$? MC_FOUND=YES - cd "`cat \"$MC_PWD_FILE\"`" && /bin/rm "$MC_PWD_FILE" break - fi - done - fi + fi + done + + if [ $MC_FOUND = NO ]; then + for mc in /usr/local/bin/mc /usr/bin/mc; do + if [ -x $mc ]; then + MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" + if [ ! -d MC_TMP_DIR="${TMPDIR-/tmp}/mc-$USER" ]; then + MC_TMP_DIR="${TMPDIR-/tmp}" + fi + MC_PWD_FILE="$MC_TMP_DIR/mc.pwd.$$" + mc_type="`mc_type.py $mc`" + if [ "$mc_type" = old ]; then + $mc -P $MC_SLOW $MC_XTERM "$@" > "$MC_PWD_FILE" + elif [ "$mc_type" = new ]; then + $mc -P "$MC_PWD_FILE" $MC_SLOW $MC_XTERM "$@" + else + continue + fi + rc=$? + MC_FOUND=YES + cd "`cat \"$MC_PWD_FILE\"`" && /bin/rm "$MC_PWD_FILE" + break + fi + done + fi - if [ $MC_FOUND = NO ]; then - echo "Cannot find mc-wrapper.sh or mc" >&2 - rc=1 - fi + if [ $MC_FOUND = NO ]; then + echo "Cannot find mc-wrapper.sh or mc" >&2 + rc=1 + fi - unset MC_FOUND MC_PWD_FILE MC_SLOW MC_TMP_DIR MC_XTERM + unset MC_FOUND MC_PWD_FILE MC_SLOW MC_TMP_DIR MC_XTERM - return $rc + return $rc } mkcd() { - if [ $# -ne 1 ]; then - echo "Usage: mkcd directory_name" >&2 - elif [ -d "$1" ]; then - cd "$1" - elif [ -e "$1" ]; then - echo "Error: $1 is a file" >&2 - else - mkdir -p "$1" && cd "$1" - fi + if [ $# -ne 1 ]; then + echo "Usage: mkcd directory_name" >&2 + elif [ -d "$1" ]; then + cd "$1" + elif [ -e "$1" ]; then + echo "Error: $1 is a file" >&2 + else + mkdir -p "$1" && cd "$1" + fi } if which tmux >/dev/null 2>&1; then - tmux() { - case "$TERM" in - rxvt) - TERM=rxvt-unicode command tmux "$@" - ;; - - *) - command tmux "$@" - ;; - esac - } + tmux() { + case "$TERM" in + rxvt) + TERM=rxvt-unicode command tmux "$@" + ;; + + *) + command tmux "$@" + ;; + esac + } fi if [ "$SHLVL" -eq 1 ] && which startx >/dev/null 2>&1; then - X() { startx >> .Xserver.log 2>&1; cyr; rm -f .Xauthority; } + X() { startx >> .Xserver.log 2>&1; cyr; rm -f .Xauthority; } fi x() { exit; }