korya /.bashrc

# /etc/bash/bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.  So make sure this doesn't display
# anything or bad things will happen !

# The following line was automatically added by Jungo tools installation
# process

export HOME_BASH_DIR="$HOME/.bash.d"
if [ -f "$HOME_BASH_DIR/.jbashrc" ]; then
    . "$HOME_BASH_DIR/.jbashrc"
elif [ -f "$MY_BASH_DIR/jbashrc" ]; then
    . "$HOME_BASH_DIR/jbashrc"
fi

# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
	# Shell is non-interactive.  Be done now!
	return
fi

# global settings
if [ -f "/etc/bashrc" ]; then
	EDITOR="$(which vim)"
	. "/etc/bashrc"
fi

# Change the window title of X terminals 
case ${TERM} in
	xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
		PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
		;;
	screen)
		PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
		;;
esac

use_color=false

# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS.  Try to use the external file
# first to take advantage of user additions.  Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs}    ]] \
	&& type -P dircolors >/dev/null \
	&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true

if ${use_color} ; then
	# Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
	if type -P dircolors >/dev/null ; then
		if [[ -f ~/.dir_colors ]] ; then
			eval $(dircolors -b ~/.dir_colors)
		elif [[ -f /etc/DIR_COLORS ]] ; then
			eval $(dircolors -b /etc/DIR_COLORS)
		fi
	fi

	if [[ ${EUID} == 0 ]] ; then
		PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
	elif [[ ${HOSTNAME} == stud1* ]]; then
		PS1='\[\033[01;32m\]\u@\[\033[01;31m\]\h\[\033[01;34m\] \w \$\[\033[00m\] '
	else
		PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
	fi

	alias ls='ls --color=auto'
	alias grep='grep --colour=auto'
	alias egrep='egrep --colour=auto'
else
	if [[ ${EUID} == 0 ]] ; then
		# show root@ when we don't have colors
		PS1='\u@\h \W \$ '
	else
		PS1='\u@\h \w \$ '
	fi
fi

# Try to keep environment pollution down, EPA loves us.
unset use_color safe_term match_lhs


# if [ -f "/etc/bash_completion" ]; then
# 	.   "/etc/bash_completion"
# fi

if [ -f "$HOME_BASH_DIR/jbash_completion" ]; then
    . "$HOME_BASH_DIR/jbash_completion"
elif [ -f "$HOME_BASH_DIR/.jbash_completion" ]; then
    . "$HOME_BASH_DIR/.jbash_completion"
fi

# Whenever displaying the prompt, write the previous line to disk
[ -n "$PROMPT_COMMAND" ] \
	&& PROMPT_COMMAND="$PROMPT_COMMAND; history -a" \
	|| PROMPT_COMMAND="history -a"

export OOO_FORCE_DESKTOP=gnome
export CDPATH=".:~:/media/sda5:/media/t2:~/Linux-234120/shared/"
export HISTSIZE=10000
export HISTIGNORE="&:ls:sl:sl *:history:mutt:[bf]g:exit"
export PATH="$HOME/bin:$PATH"

unset EDITOR
export EDITOR="/usr/bin/vim"

shopt -s cdable_vars
shopt -s cdspell
shopt -s checkwinsize
shopt -s cmdhist
shopt -s histappend
shopt -s huponexit

sttl()
{
    echo -ne "\033]0;""$*""\007"
}

# Aliases
alias ll="ls -l"
alias llh="ls -lh"
alias lla="ls -la"
alias t2="TERM='vt102' ssh so4i2014@t2.technion.ac.il"
alias cx="chmod a+x"
alias lor_fortune="fortune /usr/share/games/fortunes/lor"
alias cd..="cd .."
alias xterm="urxvt +sb -bc -j -si -sk -sw -ls"
alias SL=sl
alias l=sl
alias sls=sl
alias bs='xset dpms force suspend'
alias bse="bs && exit"
# handler called when an inserted command not found:
# command_not_found_handle () { echo FUCK OFF; return 127; }
#
# change font for console
# sudo consolechars -f UniCyr_8x16.psf --tty=/dev/tty6