2
0
Fork 0

/root/.bashrc: update to that of skel bashrc

main
Ducky 2022-01-25 19:30:43 +00:00
parent 88894c8679
commit bf675fb237
1 changed files with 24 additions and 20 deletions

View File

@ -11,12 +11,17 @@ case $- in
*) return;;
esac
# Various options
# Shell customization
if [[ -z $ZIO_SHELL_CARET ]]; then
if [[ $SUDO_USER == "astra" ]] || [[ $USER == "astra" ]]; then
ZIO_SHELL_CARET="$"
else
ZIO_SHELL_CARET="➜ "
fi
fi
# Bash options
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize
# Helpers
function color() {
@ -26,7 +31,7 @@ function color() {
[[ -z $style ]] && style="0"
if [[ -z $code ]]; then
echo "\033[00m"
echo "\033[0m"
else
echo "\033[0${style};${code}m"
fi
@ -57,12 +62,6 @@ function print_header() {
echo " "
}
function reset_shell() {
clear
update_bashrc
print_header
}
function update_bashrc() {
cp -f /etc/skel/.bashrc ~/.bashrc
}
@ -72,10 +71,10 @@ case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# Make less friendly for non-text input files
# less: make friendly for non-text input files
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# Color support for ls
# ls: color support
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
@ -87,19 +86,19 @@ if [ -x /usr/bin/dircolors ]; then
alias egrep='egrep --color=auto'
fi
# Sexy prompt
# Prompt
if [ "$color_prompt" = yes ]; then
PS1="\[$(color 32 1)\]\h$(color 37):$(color 32 1)\W$(color 37) $(color $(get_caret_color))$(color) "
PS1="\[$(color 32 1)\]\h\[$(color 37)\]:\[$(color 32 1)\]\W\[$(color 37)\] \[$(color $(get_caret_color))\]$ZIO_SHELL_CARET\[$(color)\] "
else
PS1="\h:\W >"
PS1="\h:\W > "
fi
# Source aliases (instead of editing your ~/.bashrc!)
# Aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Source bash completions
# Completions
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
@ -109,4 +108,9 @@ if ! shopt -oq posix; then
fi
# Hello, world!
reset_shell
if [[ -z $SUDO_USER ]]; then
clear
print_header
fi
update_bashrc