Files
debian/roles/setup-user/templates/.bashrc.j2
Sjaak van den Berg b229cefdc8 20251216T011536CET
2025-12-16 01:15:36 +01:00

78 lines
1.9 KiB
Django/Jinja

#!/bin/bash
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
HISTCONTROL=ignoreboth
shopt -s histappend
shopt -s checkwinsize
shopt -s globstar
HISTSIZE=5000
HISTFILESIZE=10000
STARTDIR=$HOME
# Set start directory
cd $STARTDIR || return
# Set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# Set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
NORMAL="\[\e[0m\]"
RED="\[\e[1;31m\]"
BLUE="\[\e[1;34m\]"
if [ "$color_prompt" = yes ]; then
if [ "$USER" = root ]; then
PS1="$RED\u@\h [$NORMAL\w$RED] # $NORMAL"
else
PS1="$BLUE\u@\h [$NORMAL\w$BLUE] \$ $NORMAL"
fi
else
PS1='\u@\h [\w] \$ '
fi
unset color_prompt force_color_prompt
# Enable color support of ls
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi
# Colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
[ -f ~/.bash_aliases ] && . ~/.bash_aliases
# Enable programmable completion features (you don't need to
# enable this, if it's already enabled in /etc/bash.bashrc
# and /etc/profile sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi