Thursday, December 29, 2011

bashrc

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# check terminal
if [ "$TERM" = "rxvt-unicode" ]; then
alias vim='TERM=xterm vim'
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\$ '

# User specific aliases and functions

alias ls="ls --color -F"
#alias ls="ls"
export P4CONFIG=.p4config
export SVN_EDITOR=vim
export PATH=/sbin:$PATH

#alias expctgp="export CTAGFILE=$HOME/Perforce/tags; cd ~/Perforce/"
#alias expctgw="export CTAGFILE=$HOME/workshop/tags; cd ~/workshop/"
alias expctgl="export CTAGFILE=$HOME/workshop/source/linux-3.1.1/tags; export CSCOPEFILE=$HOME/workshop/source/linux-3.1.1/cscope.out; cd $HOME/workshop/source/linux-3.1.1"

set_ctag() {
echo "export CTAGFILE=`pwd`/$@"
export CTAGFILE=`pwd`/$@
}

set_cscope() {
echo "export CTAGFILE=`pwd`/$@"
export CSCOPEFILE=`pwd`/$@
}

# convert a number into decimal format
n2d() {
perl -e "printf \"%d\n\", $@"
}

# convert a number into decimal format (floating number)
n2f() {
perl -e "printf \"%f\n\", $@"
}

# convert a number into hex format
n2h() {
perl -e "printf \"%08X\n\", $@"
}
alias n2x="n2h"

# convert a number into binary format
n2b() {
perl -e "printf \"%08b\n\", $@"
}

# convert a number into number of mage (2^20)
n2m() {
perl -e "printf \"%d (M)\n\", $@/1024/1024"
}

# convert binary number into hex format
b2h() {
perl -e "printf \"%02x\n\", 0b$@"
}
alias b2x="b2h"

No comments: