Set bash prompt

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2017-02-26 16:34:29 +01:00
parent 6ddbc9eb9c
commit 219ffc2ed1
3 changed files with 13 additions and 34 deletions

View file

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
# #
# Author: Severin Kaderli <severin.kaderli@gmail.com> # Author: Severin Kaderli <severin.kaderli@gmail.com>
# Update apt packages, npm modules and composer
alias update="sudo apt-get update; sudo apt-get dist-upgrade -y; sudo npm update -g; composer self-update"
# Shortcut for clear because I often type the DOS command instead # Shortcut for clear because I often type the DOS command instead
alias cls="clear" alias cls="clear"
# Some aliases for ls
alias ls="ls -l --color=auto"
alias ll="ls -al"

37
.bashrc
View file

@ -30,38 +30,11 @@ case "$TERM" in
xterm|xterm-color|*-256color) color_prompt=yes;; xterm|xterm-color|*-256color) color_prompt=yes;;
esac esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#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
if [[ ${EUID} == 0 ]] ; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
fi
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h \w \$ '
fi
unset color_prompt force_color_prompt unset color_prompt force_color_prompt
# enable color support of ls and also add handy aliases # Enable color support of ls
if [ -x /usr/bin/dircolors ]; then if [ -x /usr/bin/dircolors ]; then
test -r $HOME/.dircolors && eval "$(dircolors -b $HOME/.dircolors)" || eval "$(dircolors -b)" test -r $HOME/.dircolors && eval "$(dircolors -b $HOME/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
fi fi
# Sourcing alias definitions # Sourcing alias definitions
@ -87,3 +60,11 @@ fi
if [ -d "$HOME/bin" ] ; then if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:/opt/Hyper:$PATH" PATH="$HOME/bin:/opt/Hyper:$PATH"
fi fi
# Set bash prompt
RCol='\033[0m'
Gre='\033[32m';
Red='\033[31m';
Blu='\033[34m';
Yel='\033[33m';
PS1="${RCol}┌─[\`if [ \$? = 0 ]; then echo "${Gre}"; else echo "${Red}"; fi\`\t\[${Rcol}\] \[${Blu}\]\h\[${RCol}\] \[${Yel}\]\w\[${RCol}\]]\n└─╼ "

View file

@ -1,3 +0,0 @@
opacity-rule = [
"80:class_g = 'Hyper'"
];