diff options
Diffstat (limited to 'files/etc')
-rw-r--r-- | files/etc/bash.bashrc | 22 | ||||
-rw-r--r-- | files/etc/profile | 5 | ||||
-rw-r--r-- | files/etc/profile.d/prompt.sh | 45 |
3 files changed, 61 insertions, 11 deletions
diff --git a/files/etc/bash.bashrc b/files/etc/bash.bashrc index 5e594b7..8faf820 100644 --- a/files/etc/bash.bashrc +++ b/files/etc/bash.bashrc @@ -11,7 +11,7 @@ shopt -s checkwinsize # set variable identifying the chroot you work in (used in the prompt below) -if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi @@ -19,7 +19,7 @@ fi #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' # set a fancy prompt -. /usr/local/bin/prompt.sh +. /etc/profile.d/prompt.sh # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default. # If this is an xterm set the title to user@host:dir @@ -32,18 +32,26 @@ fi #esac # enable bash completion in interactive shells -if [ -f /etc/bash_completion ]; then - . /etc/bash_completion -fi +#if ! shopt -oq posix; then +# 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 # if the command-not-found package is installed, use it -if [ -x /usr/lib/command-not-found ]; then +if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then function command_not_found_handle { # check because c-n-f could've been removed in the meantime if [ -x /usr/lib/command-not-found ]; then - /usr/bin/python /usr/lib/command-not-found -- $1 + /usr/lib/command-not-found -- "$1" + return $? + elif [ -x /usr/share/command-not-found/command-not-found ]; then + /usr/share/command-not-found/command-not-found -- "$1" return $? else + printf "%s: command not found\n" "$1" >&2 return 127 fi } diff --git a/files/etc/profile b/files/etc/profile index 5a89ea5..51d0430 100644 --- a/files/etc/profile +++ b/files/etc/profile @@ -9,7 +9,7 @@ fi export PATH if [ "$PS1" ]; then - if [ "$BASH" ]; then + if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then # The file bash.bashrc already sets the default PS1. # PS1='\h:\w\$ ' if [ -f /etc/bash.bashrc ]; then @@ -24,9 +24,6 @@ if [ "$PS1" ]; then fi fi -# The default umask is now handled by pam_umask. -# See pam_umask(8) and /etc/login.defs. - if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then diff --git a/files/etc/profile.d/prompt.sh b/files/etc/profile.d/prompt.sh new file mode 100644 index 0000000..8247b1a --- /dev/null +++ b/files/etc/profile.d/prompt.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Fancy bash prompt. +# See http://www.debian-administration.org/article/Fancy_Bash_Prompts +# + +function command_prompt() { + exit_status="$?" + # colors + COLOR_RED="\[\033[31m\]" + COLOR_GREEN="\[\033[32m\]" + COLOR_YELLOW="\[\033[33m\]" + COLOR_BLUE="\[\033[34m\]" + COLOR_MAGENTA="\[\033[35m\]" + COLOR_CYAN="\[\033[36m\]" + + COLOR_RED_BOLD="\[\033[31;1m\]" + COLOR_GREEN_BOLD="\[\033[32;1m\]" + COLOR_YELLOW_BOLD="\[\033[33;1m\]" + COLOR_BLUE_BOLD="\[\033[34;1m\]" + COLOR_MAGENTA_BOLD="\[\033[35;1m\]" + COLOR_CYAN_BOLD="\[\033[36;1m\]" + + COLOR_NONE="\[\033[0m\]" + BOLD="\[\033[1m\]" + + if [ "$exit_status" == "0" ]; then + status_color="${COLOR_GREEN}" + else + status_color="${COLOR_RED_BOLD}" + fi + + # Without git completion + #PS1="(${status_color}${exit_status}${COLOR_NONE}) [${COLOR_RED}\D{%Y%m%d %H:%M:%S}${COLOR_NONE}] ${COLOR_CYAN}${debian_chroot:+($debian_chroot) }${COLOR_NONE}${COLOR_GREEN}\u@\h${COLOR_NONE}:${COLOR_CYAN}\w${COLOR_NONE} \\$ " + + # Red green theme with git completion + #PS1="(${status_color}${exit_status}${COLOR_NONE}) [${COLOR_RED}\D{%Y%m%d %H:%M:%S}${COLOR_NONE}] ${COLOR_CYAN}${debian_chroot:+($debian_chroot) }${COLOR_NONE}${COLOR_GREEN}\u@\h${COLOR_NONE}:${COLOR_CYAN}\w$(__git_ps1 " (%s)")${COLOR_NONE} \\$ " + #PS2="${BOLD}>${OFF} " + + # Yellow blue theme with git completion + PS1="${status_color}${exit_status}${COLOR_NONE} ${COLOR_CYAN}\D{%Y%m%d %H:%M:%S}${COLOR_NONE} ${COLOR_CYAN}${debian_chroot:+($debian_chroot) }${COLOR_NONE}${COLOR_YELLOW}\u@\h${COLOR_NONE}:${COLOR_CYAN}\w$(__git_ps1 " (%s)")${COLOR_NONE} \\$ " + PS2="${BOLD}>${OFF} " +} + +PROMPT_COMMAND="command_prompt" |