add color prompt and format with shfmt
This commit is contained in:
parent
5fdd854e4d
commit
5a746fd1b3
72
mybashrc
72
mybashrc
|
@ -1,5 +1,4 @@
|
|||
|
||||
# FUNCTIONS
|
||||
# FUNCTIONS
|
||||
|
||||
transfer_vtbox_net() {
|
||||
curl --progress-bar --upload-file $1 https://transfer.vtbox.net/$(basename $1) && echo "" | tee /dev/null
|
||||
|
@ -18,19 +17,18 @@ update_git_mybashrc() {
|
|||
source $HOME/.bashrc
|
||||
}
|
||||
|
||||
|
||||
EE_MYSQL_OPTIMIZATION() {
|
||||
if [ -f $HOME/.my.cnf ]; then
|
||||
mysqlcheck -Aos --auto-repair
|
||||
fi
|
||||
if [ -f $HOME/.my.cnf ]; then
|
||||
mysqlcheck -Aos --auto-repair
|
||||
fi
|
||||
}
|
||||
|
||||
encrypt_gpg() {
|
||||
gpg -c $1
|
||||
gpg -c $1
|
||||
}
|
||||
|
||||
decrypt_gpg() {
|
||||
gpg --output ${1%.gpg} -d $1
|
||||
gpg --output ${1%.gpg} -d $1
|
||||
}
|
||||
|
||||
MAINTENANCE_APT() {
|
||||
|
@ -80,25 +78,25 @@ MAINTENANCE_APT() {
|
|||
docker volume rm $list_volumes
|
||||
fi
|
||||
fi
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' EE-BASHRC UPDATE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
update_git_mybashrc
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' EE-BASHRC UPDATE '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
update_git_mybashrc
|
||||
|
||||
}
|
||||
|
||||
EE_NGINX_COMPILE() {
|
||||
if [ ! -d $HOME/.ee ]; then
|
||||
mkdir $HOME/.ee
|
||||
fi
|
||||
wget -qO $HOME/.ee/nginx-build.sh https://raw.githubusercontent.com/VirtuBox/nginx-ee/master/nginx-build.sh
|
||||
chmod +x $HOME/.ee/nginx-build.sh
|
||||
$HOME/.ee/nginx-build.sh $@
|
||||
if [ ! -d $HOME/.ee ]; then
|
||||
mkdir $HOME/.ee
|
||||
fi
|
||||
wget -qO $HOME/.ee/nginx-build.sh https://raw.githubusercontent.com/VirtuBox/nginx-ee/master/nginx-build.sh
|
||||
chmod +x $HOME/.ee/nginx-build.sh
|
||||
$HOME/.ee/nginx-build.sh $@
|
||||
}
|
||||
|
||||
EE_SHOW_LOG() {
|
||||
|
||||
tail -n 500 $1 | ccze -A
|
||||
tail -n 500 $1 | ccze -A
|
||||
|
||||
}
|
||||
|
||||
|
@ -124,8 +122,39 @@ alias ee-mysql-optimize=EE_MYSQL_OPTIMIZATION
|
|||
alias tar='tar -I pigz'
|
||||
alias showlog=EE_SHOW_LOG
|
||||
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes ;;
|
||||
esac
|
||||
|
||||
force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm* | rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
|
@ -146,8 +175,3 @@ alias maintenance=MAINTENANCE_APT
|
|||
alias ee-maintenance=MAINTENANCE_APT
|
||||
alias ee-encrypt=encrypt_gpg
|
||||
alias ee-decrypt=decrypt_gpg
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue