2022-01-25 09:22:12 +01:00
|
|
|
# DO NOT EDIT THIS FILE!
|
|
|
|
#
|
|
|
|
# Everytime this is sourced, a new version is pulled from /etc/skel/.bashrc,
|
|
|
|
# rendering any changes you make here overwritten the next time you launch Bash.
|
|
|
|
|
|
|
|
# If not running interactively, don't do anything
|
|
|
|
case $- in
|
|
|
|
*i*) ;;
|
|
|
|
*) return;;
|
|
|
|
esac
|
|
|
|
|
2022-01-25 12:49:18 +01:00
|
|
|
# Shell customization
|
2022-01-25 13:41:15 +01:00
|
|
|
if [[ -z $ZIO_SHELL_CARET ]]; then
|
|
|
|
if [[ $SUDO_USER == "astra" ]] || [[ $USER == "astra" ]]; then
|
|
|
|
ZIO_SHELL_CARET="$"
|
|
|
|
else
|
|
|
|
ZIO_SHELL_CARET="➜ "
|
|
|
|
fi
|
|
|
|
fi
|
2022-01-25 12:49:18 +01:00
|
|
|
|
|
|
|
# Bash options
|
2022-01-25 09:22:12 +01:00
|
|
|
HISTCONTROL=ignoreboth
|
|
|
|
|
|
|
|
# Helpers
|
|
|
|
function color() {
|
|
|
|
code=$1
|
|
|
|
style=$2
|
|
|
|
|
|
|
|
[[ -z $style ]] && style="0"
|
|
|
|
|
|
|
|
if [[ -z $code ]]; then
|
2022-01-25 11:20:46 +01:00
|
|
|
echo "\033[0m"
|
2022-01-25 09:22:12 +01:00
|
|
|
else
|
|
|
|
echo "\033[0${style};${code}m"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_caret_color() {
|
|
|
|
caret_color_code="36"
|
|
|
|
[[ $USER == "root" ]] && caret_color_code="31"
|
|
|
|
|
|
|
|
echo "$caret_color_code"
|
|
|
|
}
|
|
|
|
|
|
|
|
function print_header() {
|
|
|
|
echo -e "$(color 31 1) ______
|
|
|
|
|__ (_) ___
|
|
|
|
/ /| |/ _ \\
|
|
|
|
/ /_| | (_) |
|
|
|
|
/____|_|\\___/$(color)"
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
if [[ $USER == "root" ]]; then
|
2022-01-25 13:24:16 +01:00
|
|
|
echo -e "$(color 33 1) 🔥 Here be dragons.$(color)"
|
2022-01-25 09:22:12 +01:00
|
|
|
else
|
2022-01-25 13:16:08 +01:00
|
|
|
echo -e " 👋 Hello $(color 33 1)$USER$(color), I am $(color 33 1)$(hostname -f)$(color)."
|
2022-01-25 09:22:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
}
|
|
|
|
|
|
|
|
function update_bashrc() {
|
|
|
|
cp -f /etc/skel/.bashrc ~/.bashrc
|
|
|
|
}
|
|
|
|
|
|
|
|
# A dash of color?
|
|
|
|
case "$TERM" in
|
|
|
|
xterm-color|*-256color) color_prompt=yes;;
|
|
|
|
esac
|
|
|
|
|
2022-01-25 12:49:18 +01:00
|
|
|
# less: make friendly for non-text input files
|
2022-01-25 09:22:12 +01:00
|
|
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
|
|
|
2022-01-25 12:49:18 +01:00
|
|
|
# ls: color support
|
2022-01-25 09:22:12 +01:00
|
|
|
if [ -x /usr/bin/dircolors ]; then
|
|
|
|
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'
|
|
|
|
fi
|
|
|
|
|
2022-01-25 12:49:18 +01:00
|
|
|
# Prompt
|
2022-01-25 09:22:12 +01:00
|
|
|
if [ "$color_prompt" = yes ]; then
|
2022-01-25 13:30:58 +01:00
|
|
|
PS1="\[$(color 32 1)\]\h\[$(color 37)\]:\[$(color 32 1)\]\W\[$(color 37)\] \[$(color $(get_caret_color))\]$ZIO_SHELL_CARET\[$(color)\] "
|
2022-01-25 09:22:12 +01:00
|
|
|
else
|
2022-01-25 11:20:46 +01:00
|
|
|
PS1="\h:\W > "
|
2022-01-25 09:22:12 +01:00
|
|
|
fi
|
|
|
|
|
2022-01-25 12:49:18 +01:00
|
|
|
# Completions
|
2022-01-25 09:22:12 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
# Hello, world!
|
2022-01-25 13:31:44 +01:00
|
|
|
if [[ -z $SUDO_USER ]]; then
|
2022-01-25 13:30:41 +01:00
|
|
|
clear
|
|
|
|
print_header
|
|
|
|
fi
|
|
|
|
|
2022-03-02 01:35:53 +01:00
|
|
|
# Update prompt
|
|
|
|
# TODO: Tell user if something has updated
|
|
|
|
update_bashrc
|