added bashrc ovverrides and relative function to deploy.sh

This commit is contained in:
Bryan Joshua Pedini 2021-01-11 15:25:38 +01:00
parent bc6b382058
commit 07c9af1e22
10 changed files with 90 additions and 0 deletions

5
bashrc_overrides/_all Normal file
View File

@ -0,0 +1,5 @@
for source in colored_commands convenience_aliases git_functions histcontrol ls_aliases safety_aliases terminal_colors terminal_fancyfying; do
if [ -f $source ]; then
. $source
fi
done

View File

@ -0,0 +1,8 @@
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color'
fi

View File

@ -0,0 +1,3 @@
alias pubkey='cat ~/.ssh/id_rsa.pub'
alias hosts='sudo nano /etc/hosts'
alias historygrep='history | grep'

View File

@ -0,0 +1,23 @@
__git_dirty() {
if [ "$(git status 2> /dev/null | tail -1)" != "nothing to commit, working tree clean" ]; then
echo "*"
fi
}
__git_branch() {
branch=$(git branch 2>/dev/null | grep "*" | sed -e 's/\*\ //') || return
if [ "$branch" == *"detached"* ]; then
branch=$(echo "$branch" | sed -e 's/.*at\ //' | sed -e 's/)//')
fi
echo "$branch"
}
__git_prompt() {
branch=$(__git_branch)
if [ ! -z "$branch" ]; then
echo "$branch$(__git_dirty)"
else
echo "NONE"
fi
}
__git_history() {
echo "$(git log --oneline | cut -d ' ' -f 1)"
}

View File

@ -0,0 +1,9 @@
# append to the history file, don't overwrite it
shopt -s histappend
# don't put duplicate lines or lines starting with space in the history
HISTCONTROL=ignoreboth
# create unlimited history in memory/storage (more effective grepping)
HISTSIZE=
HISTFILESIZE=

View File

@ -0,0 +1,3 @@
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

View File

@ -0,0 +1,3 @@
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'

View File

@ -0,0 +1,15 @@
FORMAT_RESET="\[\033[00;37m\]"
FORMAT_BLINK="\[\033[05m\]"
FORMAT_BOLD="\[\033[02m\]"
RED="\[\033[00;31m\]"
LIGHTRED="\[\033[01;31m\]"
GREEN="\[\033[00;32m\]"
LIGHTGREEN="\[\033[01;32m\]"
BROWN="\[\033[00;33m\]"
LIGHTBROWN="\[\033[01;33m\]"
BLUE="\[\033[00;34m\]"
LIGHTBLUE="\[\033[01;34m\]"
PURPLE="\[\033[00;35m\]"
LIGHTPURPLE="\[\033[01;35m\]"
CYAN="\[\033[00;36m\]"
LIGHTCYAN="\[\033[01;36m\]"

View File

@ -0,0 +1,16 @@
GIT_FUNCTIONS=true
# Spaced
#PS1="${LIGHTBLUE}[ ${LIGHTRED}\u ${LIGHTBLUE}@ ${LIGHTBROWN}$(hostname --fqdn) ${LIGHTBLUE}] ${LIGHTPURPLE}( ${GREEN}\w ${LIGHTPURPLE}) "
# Not spaced
#PS1="${LIGHTBLUE}[${LIGHTRED}\u${LIGHTBLUE}@${LIGHTBROWN}$(hostname --fqdn)${LIGHTBLUE}]${LIGHTPURPLE}(${GREEN}\w${LIGHTPURPLE})"
# another version I really like
PS1="${PURPLE}\# ${LIGHTBLUE}{${LIGHTGREEN}\u${BROWN}@${LIGHTGREEN}\$(hostname --fqdn)${LIGHTBLUE}} ${LIGHTPURPLE}[${CYAN}\w${LIGHTPURPLE}] "
if [ $GIT_FUNCTIONS ]; then
#PS1="$PS1${LIGHTPURPLE}[${LIGHTCYAN}$(__git_prompt)${LIGHTPURPLE}]"
PS1="$PS1${LIGHTBROWN}(${LIGHTCYAN}\$(__git_prompt)${LIGHTBROWN}) "
fi
#PS1="$PS1${RED}#${FORMAT_RESET}"
PS1="$PS1${RED}${FORMAT_BLINK}\$${FORMAT_RESET}"

View File

@ -9,3 +9,8 @@ _cleanup() {
chmod +x /tmp/deploy_cleanup.sh
echo -e "$(crontab -l)\n# REF:deploy_cleanup:REF\n* * * * *\t/tmp/deploy_cleanup.sh" | crontab -
}
_bash_overrides() {
cp bashrc_overrides ~/.bashrc_overrides
echo -e "if [ -f ~/.bashrc_overrides/_all ]; then\n . ~/.bashrc_overrides\nfi" >> ~/.bashrc
}