Skip to content

Commit

Permalink
bashrc
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Oct 25, 2023
1 parent 1807058 commit 07678f3
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions files/bashrc.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ~/.bashrc: executed by bash(1) for non-login shells.

# ignore if non-interactive
case $- in
*i*) ;;
Expand All @@ -9,7 +11,7 @@ shopt -s checkwinsize \
histappend

HISTCONTROL=ignoredups
HISTFILESIZE=50000
HISTFILESIZE=20000
HISTSIZE=10000
HISTTIMEFORMAT="%F %T "

Expand All @@ -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\] "
}

0 comments on commit 07678f3

Please sign in to comment.