2021-09-13 12:49:37 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# .bashrc
|
|
|
|
|
2021-09-13 13:19:06 +02:00
|
|
|
# If not running interactively, don't do anything
|
|
|
|
case $- in
|
2021-09-13 13:23:14 +02:00
|
|
|
*i*) ;;
|
|
|
|
*) return;;
|
2021-09-13 13:19:06 +02:00
|
|
|
esac
|
|
|
|
|
2021-09-13 12:49:37 +02:00
|
|
|
# Source global definitions
|
|
|
|
if [ -f /etc/bashrc ]; then
|
|
|
|
# shellcheck disable=SC1091
|
2022-05-05 10:18:16 +02:00
|
|
|
source /etc/bashrc
|
2021-09-13 12:49:37 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Uncomment the following line if you don't like systemctl's auto-paging feature:
|
|
|
|
# export SYSTEMD_PAGER=
|
|
|
|
|
2022-05-07 11:21:08 +02:00
|
|
|
# Local bin folders in path
|
|
|
|
if [ -d /usr/local/bin ]; then
|
|
|
|
export PATH="${PATH}:/usr/local/bin"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /usr/local/sbin ]; then
|
|
|
|
export PATH="${PATH}:/usr/local/sbin"
|
|
|
|
fi
|
2021-09-13 12:49:37 +02:00
|
|
|
|
2021-09-13 13:19:06 +02:00
|
|
|
# check the window size after each command and, if necessary,
|
|
|
|
# update the values of LINES and COLUMNS.
|
|
|
|
shopt -s checkwinsize
|
|
|
|
|
|
|
|
# make less more friendly for non-text input files, see lesspipe(1)
|
|
|
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
|
|
|
|
|
|
# set variable identifying the chroot you work in (used in the prompt below)
|
|
|
|
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
2021-09-13 13:23:14 +02:00
|
|
|
debian_chroot=$(cat /etc/debian_chroot)
|
2021-09-13 13:19:06 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# If this is an xterm set the title to user@host:dir
|
|
|
|
case "$TERM" in
|
2021-09-13 13:23:14 +02:00
|
|
|
xterm*|rxvt*)
|
2021-09-13 13:19:06 +02:00
|
|
|
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
|
|
|
;;
|
2021-09-13 13:23:14 +02:00
|
|
|
*)
|
2021-09-13 13:19:06 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# enable color support of ls and also add handy aliases
|
|
|
|
if [ -x /usr/bin/dircolors ]; then
|
|
|
|
# shellcheck disable=SC2015
|
2021-09-13 13:23:14 +02:00
|
|
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
#alias dir='dir --color=auto'
|
|
|
|
#alias vdir='vdir --color=auto'
|
|
|
|
|
|
|
|
alias grep='grep --color=auto'
|
|
|
|
alias fgrep='fgrep --color=auto'
|
|
|
|
alias egrep='egrep --color=auto'
|
2021-09-13 13:19:06 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# some more ls aliases
|
|
|
|
alias ll='ls -alF'
|
|
|
|
alias la='ls -A'
|
|
|
|
alias l='ls -CF'
|
|
|
|
|
|
|
|
# Add an "alert" alias for long running commands. Use like so:
|
|
|
|
# sleep 10; alert
|
|
|
|
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
|
|
|
|
|
|
|
# Alias definitions.
|
|
|
|
# You may want to put all your additions into a separate file like
|
|
|
|
# ~/.bash_aliases, instead of adding them here directly.
|
|
|
|
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
|
|
|
|
|
|
|
if [ -f ~/.bash_aliases ]; then
|
2021-09-13 13:23:14 +02:00
|
|
|
# shellcheck disable=SC1090
|
2022-05-05 10:18:16 +02:00
|
|
|
source ~/.bash_aliases
|
2021-09-13 13:19:06 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# shellcheck disable=SC1091
|
2022-05-05 10:18:16 +02:00
|
|
|
source /usr/share/bash-completion/bash_completion
|
2021-09-13 13:19:06 +02:00
|
|
|
elif [ -f /etc/bash_completion ]; then
|
|
|
|
# shellcheck disable=SC1091
|
2022-05-05 10:18:16 +02:00
|
|
|
source /etc/bash_completion
|
2021-09-13 13:19:06 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "${HOME}/.screen"
|
|
|
|
export SCREENDIR="${HOME}/.screen"
|
2021-09-13 12:49:37 +02:00
|
|
|
|
2022-05-07 11:16:52 +02:00
|
|
|
# Source other RC files
|
2021-09-13 12:49:37 +02:00
|
|
|
mkdir -p "${HOME}/.bashrc.d"
|
2022-05-07 11:16:52 +02:00
|
|
|
for bashrc_file in $(find "${HOME}/.bashrc.d" -type f | grep -v '\.bak$' |grep -v '~$' | sort)
|
2021-09-13 12:49:37 +02:00
|
|
|
do
|
2022-05-05 15:50:05 +02:00
|
|
|
if [ -n "${bashrc_file}" ]; then
|
2022-05-05 10:18:16 +02:00
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "${bashrc_file}"
|
|
|
|
fi
|
2022-05-05 15:50:05 +02:00
|
|
|
done
|