Browse Source

Initial commit

master
Kolan Sh 9 years ago
commit
7b46e833f5
  1. 16
      README
  2. 47
      alias.sh
  3. 1
      completion.sh
  4. 13
      constants.sh
  5. 16
      extensions.sh
  6. 67
      funstions.sh
  7. 4
      prompt.sh
  8. 22
      scm.sh
  9. 5
      screen.sh
  10. 2
      user.sh

16
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

47
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

1
completion.sh

@ -0,0 +1 @@
[ -x /etc/profile.d/bash-completion.sh ] && . /etc/profile.d/bash-completion.sh

13
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"

16
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"

67
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
}

4
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\] \\
"

22
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

5
screen.sh

@ -0,0 +1,5 @@
case $TERM in
screen)
export PROMPT_COMMAND='echo -n -e "\033k\033\\"'
;;
esac

2
user.sh

@ -0,0 +1,2 @@
export NAME="Kolan Sh."
export EMAIL=mecareful@gmail.com
Loading…
Cancel
Save