init
commit
92fba87e05
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
!.gitignore
|
||||
|
||||
!/etc/
|
||||
/etc/*
|
||||
!/etc/issue
|
||||
|
||||
!/etc/skel/
|
||||
/etc/skel/*
|
||||
!/etc/skel/.bashrc
|
||||
|
||||
!/root/
|
||||
/root/*
|
||||
!/root/.bashrc
|
|
@ -0,0 +1,112 @@
|
|||
# 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.
|
||||
#
|
||||
# Put any extra aliases, functions, or other mess into ~/.bash_aliases.
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# Various options
|
||||
HISTCONTROL=ignoreboth
|
||||
shopt -s histappend
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
shopt -s checkwinsize
|
||||
|
||||
# Helpers
|
||||
function color() {
|
||||
code=$1
|
||||
style=$2
|
||||
|
||||
[[ -z $style ]] && style="0"
|
||||
|
||||
if [[ -z $code ]]; then
|
||||
echo "\033[00m"
|
||||
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
|
||||
echo -e "$(color 33 1) 🔥 Here be dragons.$(color)"
|
||||
else
|
||||
echo -e " 👋 Hello $(color 33 1)$USER$(color), I am $(color 33 1)$(hostname -f)$(color)."
|
||||
fi
|
||||
|
||||
echo " "
|
||||
}
|
||||
|
||||
function reset_shell() {
|
||||
clear
|
||||
update_bashrc
|
||||
print_header
|
||||
}
|
||||
|
||||
function update_bashrc() {
|
||||
cp -f /etc/skel/.bashrc ~/.bashrc
|
||||
}
|
||||
|
||||
# A dash of color?
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# Make less friendly for non-text input files
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# Color support for ls
|
||||
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
|
||||
|
||||
# Sexy prompt
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1="\[$(color 32 1)\]\h$(color 37):$(color 32 1)\W$(color 37) $(color $(get_caret_color))➜ $(color) "
|
||||
else
|
||||
PS1="\h:\W >"
|
||||
fi
|
||||
|
||||
# Source aliases (instead of editing your ~/.bashrc!)
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# Source bash completions
|
||||
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!
|
||||
reset_shell
|
|
@ -0,0 +1,112 @@
|
|||
# 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.
|
||||
#
|
||||
# Put any extra aliases, functions, or other mess into ~/.bash_aliases.
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# Various options
|
||||
HISTCONTROL=ignoreboth
|
||||
shopt -s histappend
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
shopt -s checkwinsize
|
||||
|
||||
# Helpers
|
||||
function color() {
|
||||
code=$1
|
||||
style=$2
|
||||
|
||||
[[ -z $style ]] && style="0"
|
||||
|
||||
if [[ -z $code ]]; then
|
||||
echo "\033[00m"
|
||||
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
|
||||
echo -e "$(color 33 1) 🔥 Here be dragons.$(color)"
|
||||
else
|
||||
echo -e " 👋 Hello $(color 33 1)$USER$(color), I am $(color 33 1)$(hostname -f)$(color)."
|
||||
fi
|
||||
|
||||
echo " "
|
||||
}
|
||||
|
||||
function reset_shell() {
|
||||
clear
|
||||
update_bashrc
|
||||
print_header
|
||||
}
|
||||
|
||||
function update_bashrc() {
|
||||
cp -f /etc/skel/.bashrc ~/.bashrc
|
||||
}
|
||||
|
||||
# A dash of color?
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# Make less friendly for non-text input files
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# Color support for ls
|
||||
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
|
||||
|
||||
# Sexy prompt
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1="\[$(color 32 1)\]\h$(color 37):$(color 32 1)\W$(color 37) $(color $(get_caret_color))➜ $(color) "
|
||||
else
|
||||
PS1="\h:\W >"
|
||||
fi
|
||||
|
||||
# Source aliases (instead of editing your ~/.bashrc!)
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# Source bash completions
|
||||
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!
|
||||
reset_shell
|
Loading…
Reference in New Issue