commit 7b46e833f55e0a0081ab304f37052667eb3e7148 Author: Kolan Sh Date: Fri May 18 13:46:36 2012 +0400 Initial commit diff --git a/README b/README new file mode 100644 index 0000000..ff7c94e --- /dev/null +++ b/README @@ -0,0 +1,16 @@ +# Create ~/.bash_profile + +[[ -f ~/.bashrc ]] && . ~/.bashrc + +# Create ~/.bashrc file with contents below. + +#!/bin/bash + +BDOTDIR=~/.bash + +source $BDOTDIR/constants.sh +for rc in $BDOTDIR/*.sh +do + source $rc +done +unset rc diff --git a/alias.sh b/alias.sh new file mode 100755 index 0000000..e06df6f --- /dev/null +++ b/alias.sh @@ -0,0 +1,47 @@ +alias dfh='df -hT' +alias dfm='df -mT' +alias la='ls -a' +alias ll='ls -l' +alias l='ll' +alias lh='ls -h' +alias lla='ls -la' +alias llh='ls -lh' +alias llah='ls -lah' +alias llha='llah' +alias su='sudo su -' +alias hd='hexdump -C' +alias cp='cp -vi' +alias mv='mv -vi' +alias rm='rm -vi' +alias ln='ln -vi' +alias chmod='chmod -v' +alias chown='chown -v' +alias chgrp='chgrp -v' +alias mkdir='mkdir -v' +alias rmdir='rmdir -v' +alias fs='du -shcx * .[^.]* 2>/dev/null | sort -h' +which sudo &>/dev/null && alias krnlconfig="sudo make MENUCONFIG_MODE=single_menu MENUCONFIG_COLOR=mono menuconfig" +which valgrind &>/dev/null && alias valgrind='valgrind --tool=callgrind' +which cgdb &>/dev/null && alias cgdb='LANG=ru_RU.koi8-r cgdb' +which rsync &>/dev/null && alias cpb='rsync --progress -h' \ + && alias cpbs='rsync --progress -h -rax --delete-excluded' +which alsamixer &>/dev/null && alias alsamixer='alsamixer -g' && alias equilizer='alsamixer -D equal' +which valgrind &>/dev/null && +which valgrind &>/dev/null && +which valgrind &>/dev/null && +[ -x /usr/libexec/mc/mc-wrapper.sh ] && alias mc='. /usr/libexec/mc/mc-wrapper.sh -x' +which network.sh &>/dev/null && alias net='network.sh' +which colordiff &>/dev/null && alias diff='colordiff' +which colormake &>/dev/null && alias make='colormake 2>/dev/null' +if [ `which colorgcc 2>/dev/null` ]; then + alias c++='/usr/lib/colorgcc/bin/c++' + alias cc='/usr/lib/colorgcc/bin/cc' + alias g++='/usr/lib/colorgcc/bin/g++' + alias gcc='/usr/lib/colorgcc/bin/gcc' +fi + +if [ `which grc 2>/dev/null` ]; then + alias configure='grc configure' + alias netstat='grc netstat' + alias ping='grc ping' +fi diff --git a/completion.sh b/completion.sh new file mode 100755 index 0000000..acc5f3f --- /dev/null +++ b/completion.sh @@ -0,0 +1 @@ +[ -x /etc/profile.d/bash-completion.sh ] && . /etc/profile.d/bash-completion.sh diff --git a/constants.sh b/constants.sh new file mode 100755 index 0000000..e0ba07d --- /dev/null +++ b/constants.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +umask 0002 +shopt -s histappend +shopt -s cmdhist +shopt -s cdspell +export PATH="$PATH:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:~/bin:~/scripts" +[ -x /usr/bin/vim ] && export EDITOR=/usr/bin/vim +export HISTCONTROL="ignoredupes" +HISTIGNORE="&:ls:[bf]g:exit: cd \"\`*: PROMPT_COMMAND=\'*:cd \'/*" +export LESS=' -R ' +export PROMPT_COMMAND='history -a' +[ -x /usr/bin/src/hilite-lesspipe.sh ] && export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" diff --git a/extensions.sh b/extensions.sh new file mode 100755 index 0000000..0a59f9f --- /dev/null +++ b/extensions.sh @@ -0,0 +1,16 @@ +[[ -z $DISPLAY ]] && { + alias -s {jpg,jpeg,bmp,gif,png,svg,xbm,psd}="fbi" + alias -s {avi,mpeg,mpg,3gp}="video" + alias -s {html,htm}="links -g" + alias -s {txt,lst}="cat" +} || { + alias -s {jpg,jpeg,bmp,gif,png,svg}="eog" + alias -s {pdf,djvu}="nohup > /dev/null 2>&1 evince" + alias -s {avi,mpeg,mpg,3gp}="mplayer" + alias -s {odt,doc,rtf}="nohup > /dev/null 2>&1 oowriter" + alias -s {html,htm}="firefox" + alias -s {txt,lst}="cat" + alias -s exe="wine" +} + +alias -s {wav,mp3,ogg}="alsaplayer" diff --git a/funstions.sh b/funstions.sh new file mode 100755 index 0000000..9898bef --- /dev/null +++ b/funstions.sh @@ -0,0 +1,67 @@ +extract () { + if [ -f $1 ]; then + case $1 in + *.tar.bz2) + tar xjvf $1 ;; + *.tar.gz) + tar xzvf $1 ;; + *.bz2) + bzcat $1 > ${1%.bz2} ;; + *.rar) + unrar x $1 ;; + *.gz) + zcat $1 > ${1%.gz} ;; + *.tar) + tar xvf $1 ;; + *.tbz2) + tar xjvf $1 ;; + *.tgz) + tar xzvf $1 ;; + *.zip) + unzip $1 ;; + *.Z) + uncompress $1 ;; + *.7z) + 7z x $1 ;; + *.tbz) + tar xjvf ;; + *) + echo "Unable to extract '$1'" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + +compress () { + if [ $1 ]; then + case $1 in + tbz) + tar cjvf $2.tar.bz2 $2 ;; + tgz) + tar czvf $2.tar.gz $2 ;; + tar) + tar cpvf $2.tar $2 ;; + bz2) + bzip $2 ;; + gz) + gzip -c -9 -n $2 > $2.gz ;; + zip) + zip -r $2.zip $2 ;; + 7z) + 7z a $2.7z $2 ;; + *) + echo "Unable to compress '$1'" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + +calc() { + echo $* | bc +} + +cdl() { + cd "$1" && ll +} diff --git a/prompt.sh b/prompt.sh new file mode 100755 index 0000000..34dce56 --- /dev/null +++ b/prompt.sh @@ -0,0 +1,4 @@ +export PS1="\[\033[01;36m\]\u@\[\033[01;35m\]\h\[\033[01;34m\] \w\\ +\[\033[01;30m\]\$(__git_ps1)\$(__hg_ps1) \\ +\[\033[01;36m\]\$\[\033[00m\] \\ +" diff --git a/scm.sh b/scm.sh new file mode 100755 index 0000000..4f3efc9 --- /dev/null +++ b/scm.sh @@ -0,0 +1,22 @@ +if [ `which git 2>/dev/null` ]; then + __git_ps1 () + { + local b="$(git symbolic-ref HEAD 2>/dev/null)"; + if [ -n "$b" ]; then + printf "(%s)" "${b##refs/heads/}"; + fi + } +fi + +if [ `which hg 2>/dev/null` ]; then + __hg_ps1 () + { + while [[ ! -d .hg && `pwd` != / ]]; do cd .. ; done + if [[ "`pwd`" != "$HOME" ]]; then + local b="$(cat .hg/branch 2>/dev/null)"; + if [ -n "$b" ]; then + printf "(%s)" "${b}"; + fi + fi + } +fi diff --git a/screen.sh b/screen.sh new file mode 100755 index 0000000..6276a1a --- /dev/null +++ b/screen.sh @@ -0,0 +1,5 @@ +case $TERM in + screen) + export PROMPT_COMMAND='echo -n -e "\033k\033\\"' + ;; +esac diff --git a/user.sh b/user.sh new file mode 100755 index 0000000..8fadfa3 --- /dev/null +++ b/user.sh @@ -0,0 +1,2 @@ +export NAME="Kolan Sh." +export EMAIL=mecareful@gmail.com