Bashrc cleaned up. Local definitions are moved to a separate file.
This commit is contained in:
252
config/.bashrc
Normal file → Executable file
252
config/.bashrc
Normal file → Executable file
@@ -1,4 +1,4 @@
|
|||||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
#!/bin/bash
|
||||||
|
|
||||||
# ~/.bashrc skeleton
|
# ~/.bashrc skeleton
|
||||||
# ~/.bashrc runs ONLY on non-login subshells! (different from ksh)
|
# ~/.bashrc runs ONLY on non-login subshells! (different from ksh)
|
||||||
@@ -7,109 +7,6 @@
|
|||||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
#echo "BASHRC has run"
|
#echo "BASHRC has run"
|
||||||
|
|
||||||
# If not running interactively, don't do anything
|
|
||||||
case $- in
|
|
||||||
*i*) ;;
|
|
||||||
*) return;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# don't put duplicate lines or lines starting with space in the history.
|
|
||||||
# See bash(1) for more options
|
|
||||||
HISTCONTROL=ignoreboth
|
|
||||||
# append to the history file, don't overwrite it
|
|
||||||
shopt -s histappend
|
|
||||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
|
||||||
HISTSIZE=1000
|
|
||||||
HISTFILESIZE=2000
|
|
||||||
|
|
||||||
# check the window size after each command and, if necessary,
|
|
||||||
# update the values of LINES and COLUMNS.
|
|
||||||
shopt -s checkwinsize
|
|
||||||
|
|
||||||
# If set, the pattern "**" used in a pathname expansion context will
|
|
||||||
# match all files and zero or more directories and subdirectories.
|
|
||||||
#shopt -s globstar
|
|
||||||
|
|
||||||
# make less more friendly for non-text input files, see lesspipe(1)
|
|
||||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
|
||||||
case "$TERM" in
|
|
||||||
xterm-color) color_prompt=yes;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
|
||||||
# off by default to not distract the user: the focus in a terminal window
|
|
||||||
# should be on the output of commands, not on the prompt
|
|
||||||
force_color_prompt=yes
|
|
||||||
|
|
||||||
if [ -n "$force_color_prompt" ]; then
|
|
||||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
|
||||||
# We have color support; assume it's compliant with Ecma-48
|
|
||||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
|
||||||
# a case would tend to support setf rather than setaf.)
|
|
||||||
color_prompt=yes
|
|
||||||
else
|
|
||||||
color_prompt=
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$color_prompt" = yes ]; then
|
|
||||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
|
|
||||||
else
|
|
||||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
|
||||||
fi
|
|
||||||
unset color_prompt force_color_prompt
|
|
||||||
|
|
||||||
# If this is an xterm set the title to user@host:dir
|
|
||||||
case "$TERM" in
|
|
||||||
xterm*|rxvt*)
|
|
||||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# enable color support of ls and also add handy aliases
|
|
||||||
if [ -x /usr/bin/dircolors ]; then
|
|
||||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
|
||||||
alias ls='ls --color=auto'
|
|
||||||
|
|
||||||
alias grep='grep --color=auto'
|
|
||||||
alias fgrep='fgrep --color=auto'
|
|
||||||
alias egrep='egrep --color=auto'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# colored GCC warnings and errors
|
|
||||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
|
||||||
|
|
||||||
# some more ls aliases
|
|
||||||
alias ll='ls -lAF'
|
|
||||||
|
|
||||||
# Alias definitions.
|
|
||||||
# You may want to put all your additions into a separate file like
|
|
||||||
# ~/.bash_aliases, instead of adding them here directly.
|
|
||||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
|
||||||
|
|
||||||
if [ -f ~/.bash_aliases ]; then
|
|
||||||
. ~/.bash_aliases
|
|
||||||
fi
|
|
||||||
|
|
||||||
# enable programmable completion features (you don't need to enable
|
|
||||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
|
||||||
# sources /etc/bash.bashrc).
|
|
||||||
if ! shopt -oq posix; then
|
|
||||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
|
||||||
. /usr/share/bash-completion/bash_completion
|
|
||||||
elif [ -f /etc/bash_completion ]; then
|
|
||||||
. /etc/bash_completion
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
#
|
#
|
||||||
# Source global definitions
|
# Source global definitions
|
||||||
@@ -141,103 +38,6 @@ fi
|
|||||||
|
|
||||||
umask 002
|
umask 002
|
||||||
|
|
||||||
#
|
|
||||||
#alias dirs='dirs -v'
|
|
||||||
#alias ack='ack --ignore-file=ext:d,dd'
|
|
||||||
#
|
|
||||||
#alias dirtree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' "
|
|
||||||
#alias currgit='cd /bb/mbig/mbig1205/devgit/s_tktapi2/src; echo -e "I am here $(pwd)"'
|
|
||||||
#alias tktapi='cd /bb/mbig/mbig1205/devgit/tktapi/src; echo -e "I am here $(pwd) \n $(ls)"'
|
|
||||||
#alias bastest='/bbsrc/abin/basclient'
|
|
||||||
#alias bas_codegen='/bb/shared/bin/bas_codegen.pl'
|
|
||||||
#alias metasymfind="cat - | awk '{ print \$1 }' | xargs symfind | awk 'BEGIN{FS=\"[\"} { print \$1 }' | sort | uniq | tr '\n' ' ' | sed -e 's/\(\b\S\)/-l\1/g' && echo \"\""
|
|
||||||
#
|
|
||||||
#alias git-robo='ssh devgit svnsync $(git remote -v | grep "(fetch)" | cut -d ":" -f2 | cut -d "(" -f1); git fetch origin; git pull; git merge robo/trunk; read -p "!!!!! PUSH the merged version back !!!!! ? [Y] / Ctrl+C to stop"; git push'
|
|
||||||
#alias intuorcreate=/bbsrc/internal/isystest/uorcreate/intuorcreate
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#export EDITOR=/opt/swt/bin/nedit
|
|
||||||
#export TERM=xterm
|
|
||||||
#
|
|
||||||
#export BIGHOME=/bb/mbig/mbig1205
|
|
||||||
#export PLINK_PARALLEL_BUILD=true
|
|
||||||
#export EDITOR=/opt/swt/bin/nedit
|
|
||||||
#export PAGER=less
|
|
||||||
#export GROUP=trading-systems-group
|
|
||||||
#export mysvn="svn+ssh://devsvn"
|
|
||||||
#export myrobosvn="svn+ssh://devsvn/robo/branches/trunk"
|
|
||||||
#export PATH=/opt/swt/bin:~/bin:/bb/util/common/studio12/SUNWspro/bin:${PATH}
|
|
||||||
#export DEVGIT=${BIGHOME}/devgit
|
|
||||||
#export VISUAL=/opt/swt/bin/nedit
|
|
||||||
#export MAIL=/usr/mail/${LOGNAME:?}
|
|
||||||
#
|
|
||||||
#codegrep() {
|
|
||||||
# if [[ $# -eq 0 ]]
|
|
||||||
# then
|
|
||||||
# echo "Usage: codegrep <pattern> "
|
|
||||||
# else
|
|
||||||
# grep -nT --colour \
|
|
||||||
# --exclude=tags \
|
|
||||||
# --exclude=*.o \
|
|
||||||
# --exclude=*.so \
|
|
||||||
# --exclude=*.tsk \
|
|
||||||
# --exclude=*.d \
|
|
||||||
# --exclude=*.dd \
|
|
||||||
# "$1" *
|
|
||||||
# fi
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
##ssh() {
|
|
||||||
# #echo "wut"
|
|
||||||
# #[[ -n "$INSCREEN" ]] && TERM=screen-256color
|
|
||||||
# #env ssh -t $*
|
|
||||||
# #$SCREEN_TITLE_CMD
|
|
||||||
##}
|
|
||||||
#
|
|
||||||
#sshcd() {
|
|
||||||
# if [[ $# -lt 1 ]]
|
|
||||||
# then
|
|
||||||
# echo "Usage: sshcd <server> [<path>]"
|
|
||||||
# else
|
|
||||||
# ssh -t $LOGNAME@$1 "export SSHCDPATH=${path:-$(pwd)}; exec $BASH --login "
|
|
||||||
# fi
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
#biggest() {
|
|
||||||
# dir=${1:-.}
|
|
||||||
# find $dir -type f -exec du -a {} \+ | sort -rn
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
## Screen variables
|
|
||||||
#function last2dirs {
|
|
||||||
# pwd | awk -F\/ '{print $(NF-1),$(NF)}' | sed 's# #/#'
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
##screen specific functionality
|
|
||||||
##if [[ -n ${STY} ]]
|
|
||||||
##then
|
|
||||||
# PROMPT_COMMAND='echo -ne "\033k${HOSTNAME} $(last2dirs)\033\\";
|
|
||||||
# history -a;'
|
|
||||||
##fi
|
|
||||||
#
|
|
||||||
#function dupscreen {
|
|
||||||
# screen bash -c "export SSHCDPATH=$PWD && exec $SHELL --login"
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
#if [ -n "$BBENV" ] && [[ -f ~/bin/hijackEOD.sh ]]
|
|
||||||
#then
|
|
||||||
# source `which hijackEOD.sh`
|
|
||||||
#fi
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Don't source the rest twice.
|
|
||||||
#
|
|
||||||
#if [ "$BASHRC_VAHAGNK_DONT_SOURCE_THIS_FILE_TWICE" == "true" ]; then
|
|
||||||
# return
|
|
||||||
#fi
|
|
||||||
|
|
||||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
#
|
#
|
||||||
# Find out system details.
|
# Find out system details.
|
||||||
@@ -249,6 +49,15 @@ kversion=`uname -v`
|
|||||||
krelease=`uname -r`
|
krelease=`uname -r`
|
||||||
hostnm=`hostname`
|
hostnm=`hostname`
|
||||||
|
|
||||||
|
#
|
||||||
|
# Tmux usually sets screen-256color which is unknown to most of systems I work
|
||||||
|
# with.
|
||||||
|
#
|
||||||
|
if [ "$TERM" == "screen-256color" ]; then
|
||||||
|
export TERM="xterm-256color"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
#
|
#
|
||||||
# User specific environment and startup programs
|
# User specific environment and startup programs
|
||||||
#
|
#
|
||||||
@@ -260,7 +69,6 @@ fi
|
|||||||
MYSCRIPTS=$HOME/devel/scripts
|
MYSCRIPTS=$HOME/devel/scripts
|
||||||
PATH=$MYLOCAL/bin:$PATH
|
PATH=$MYLOCAL/bin:$PATH
|
||||||
PATH=$MYSCRIPTS/bash:$PATH
|
PATH=$MYSCRIPTS/bash:$PATH
|
||||||
PATH=$MYSCRIPTS/bloomberg:$PATH
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# VIM
|
# VIM
|
||||||
@@ -319,36 +127,28 @@ PATH=$MYSCRIPTS/bloomberg:$PATH
|
|||||||
|
|
||||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
#
|
#
|
||||||
# BLOOMBERG and TOMS
|
# Run local settings.
|
||||||
#
|
#
|
||||||
|
[ -f $PWD/.bashrc.local ] && . $PWD/.bashrc.local
|
||||||
|
|
||||||
# if chimera generated aliases exist, pull them into the current ENV
|
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
[ -f ~/.bbalias ] && . ~/.bbalias
|
|
||||||
|
|
||||||
export BB=$HOME/devel/bb
|
|
||||||
export DEVGIT=$BB/devgit
|
|
||||||
PATH=$PATH:$BB/scripts
|
|
||||||
|
|
||||||
getpw() { # BOX
|
|
||||||
if [[ $# -ne 1 ]]; then
|
|
||||||
echo "Usage: getpw <machine>"
|
|
||||||
else
|
|
||||||
local BOX="$1"
|
|
||||||
local BIN="/bb/bin/getprdwin"
|
|
||||||
$BIN -u op1 -i -s $BOX -d "op1 for $USER on $BOX"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
alias create_tags='/opt/swt/bin/ctags -R --verbose --exclude=.git --exclude=.doxygen --exclude="*.o" --exclude="llcalc*"'
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# set alias
|
# set alias
|
||||||
#
|
#
|
||||||
alias ll='ls -la --color=tty'
|
if [ $kernel == AIX ]; then
|
||||||
alias cd='pushd >/dev/null'
|
alias l='ls -a'
|
||||||
|
alias ls='ls -a'
|
||||||
|
alias ll='ls -la'
|
||||||
|
alias pd='pushd >/dev/null'
|
||||||
alias bd='popd'
|
alias bd='popd'
|
||||||
alias bb='pushd $HOME/devel/bb >/dev/null'
|
else
|
||||||
alias cgrep="grep --include \*.cpp --include \*.h --include \*.c --color=auto"
|
alias l='ls -a --color=tty'
|
||||||
#complete -f --X '!*.mk' plink
|
alias ls='ls -a --color=tty'
|
||||||
|
alias ll='ls -la --color=tty'
|
||||||
|
alias pd='pushd >/dev/null'
|
||||||
|
alias bd='popd'
|
||||||
|
fi
|
||||||
|
alias cgrep="grep --include \*.cpp --include \*.h --include \*.c"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Make sure to export PATH
|
# Make sure to export PATH
|
||||||
|
|||||||
Reference in New Issue
Block a user