11# ~/.bashrc: executed by bash(1) for non-login shells.
22
3+ # ##################################
4+ # Settings for this .bashrc
5+
6+ # change the following to 1 if the return code shall show up.
7+ SHOW_RETURN_CODE=0
8+
9+ # ##################################
10+
311is_interactive_shell () {
412 case $- in
513 * i* ) return 0;;
@@ -10,6 +18,10 @@ is_interactive_shell() {
1018# If not running interactively, don't do anything
1119is_interactive_shell || return 0
1220
21+ # ##################################
22+ # history settings:
23+
24+
1325# Ignore duplicate lines and space lines:
1426export HISTCONTROL=ignoreboth
1527
@@ -19,10 +31,48 @@ shopt -s histappend
1931# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
2032export HISTSIZE=2000
2133
34+ # ##################################
35+ # other shell options:
36+
2237# check the window size after each command and, if necessary,
2338# update the values of LINES and COLUMNS.
2439shopt -s checkwinsize
2540
41+ # Set vi editing mode:
42+ set -o vi
43+
44+ # ##################################
45+ # colour for the shell
46+
47+ # Use color if terminal has the capability
48+ if [ -x /usr/bin/tput ] && tput setaf 1 >& /dev/null; then
49+ # We have color support; assume it's compliant with Ecma-48
50+ # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
51+ # a case would tend to support setf rather than setaf.)
52+
53+ UCOL=" \[\033[0;00m\]" # color for user
54+ HCOL=" \[\033[0;33m\]" # color for host
55+ PCOL=" \[\033[1;34m\]" # color for dir
56+ DEFC=" \[\033[0;00m\]" # default color
57+ PS1=" ${debian_chroot: +($debian_chroot )} $UCOL \u$DEFC @$HCOL \h$DEFC :$PCOL \w$DEFC \$ "
58+
59+ unset UCOL HCOL PCOL DEFC
60+ else
61+ PS1=' ${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
62+ fi
63+
64+ # If this is an xterm set the title to user@host:dir
65+ case " $TERM " in
66+ xterm* |rxvt* )
67+ PS1=" \[\e]0;${debian_chroot: +($debian_chroot )} \u@\h: \w\a\]$PS1 "
68+ ;;
69+ * )
70+ ;;
71+ esac
72+
73+ # ##################################
74+ # colour for other programs:
75+
2676# Enable color support of ls
2777if [ -x /usr/bin/dircolors ]; then
2878 eval " ` dircolors -b` "
@@ -40,13 +90,27 @@ export LS_OPTIONS='--color=auto'
4090alias ls=' ls -vF $LS_OPTIONS'
4191alias ll=' ls -al'
4292
43- alias cd..=' cd ..'
44- alias ..=' cd ..'
93+ unset GREP_OPTIONS
4594
95+ # ##################################
96+ # misc
97+
98+ # change the prompt if the user wishes
99+ if [ " $BASH " == " /bin/bash" -a " $SHOW_RETURN_CODE " == " 1" ]; then
100+ promt_extra () {
101+ local RET=$?
102+ if [ " $RET " != " 0" ]; then
103+ echo -e " rc: \033[0;32m$RET \033[0;00m"
104+ fi
105+ }
106+ export PROMPT_COMMAND=' promt_extra'
107+ fi
108+
109+ # Enable bash completion:
46110if [ -f /etc/bash_completion ]; then
47111 . /etc/bash_completion
48112fi
49113
50- if [ -f " $HOME /return_code_prompt " ] ; then
51- . " $HOME /return_code_prompt "
52- fi
114+ # ##################################
115+ # cleanup
116+ unset SHOW_RETURN_CODE
0 commit comments