diff --git a/files/bashrc.bash b/files/bashrc.bash index fb67a1c..727b199 100644 --- a/files/bashrc.bash +++ b/files/bashrc.bash @@ -1,3 +1,5 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. + # ignore if non-interactive case $- in *i*) ;; @@ -9,7 +11,7 @@ shopt -s checkwinsize \ histappend HISTCONTROL=ignoredups -HISTFILESIZE=50000 +HISTFILESIZE=20000 HISTSIZE=10000 HISTTIMEFORMAT="%F %T " @@ -18,19 +20,22 @@ alias cd..="cd .." bind 'set completion-ignore-case on' if ! shopt -oq posix; then - if [[ -r /usr/share/bash-completion/bash_completion ]]; then - source /usr/share/bash-completion/bash_completion - elif [[ -r /etc/bash_completion ]]; then - source /etc/bash_completion + 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 PROMPT_COMMAND=__prompt_command __prompt_command() { - local last_exit_status="$?" + local last_status="$?" PS1="\[\033[2m\]" - if [[ "${last_exit_status}" != 0 ]]; then - PS1+="=> \[\033[31m\]${last_exit_status}\[\033[39m\]\n" + if [[ "${last_status}" != 0 ]]; then PS1+="=> \[\033[31m\]${last_status}\[\033[39m\]\n"; fi + if [[ $(id -u) -eq 0 ]]; then + PS1+="\[\033[31m\]\u\[\033[39m\]" + else + PS1+="\u" fi - PS1+="\u@\h:\w\n\$\[\033[0m\] " + PS1+="@$(hostname --fqdn):\w\n\$\[\033[0m\] " }