Home Android Arch Linux Gentoo Linux LibreELEC Github Geo

BASH anpassen und erweitern


den Inhalt der Datei /etc/bash.bashrc ersetzen
nano /etc/bash.bashrc

/etc/bash.bashrc

#
# /etc/bash.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

# prompt only the last 2 dirs
PROMPT_DIRTRIM=2

if [[ ${EUID} == 0 ]] ; then
   PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
   PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w'
   # if git-prompt.sh exist, prompt git-branch inside a git directory, else only '$'
   if [ -f /usr/share/git/git-prompt.sh ]; then
      . /usr/share/git/git-prompt.sh
      GIT_PS1_SHOWDIRTYSTATE=1
      GIT_PS1_SHOWSTASHSTATE=1
      GIT_PS1_SHOWUPSTREAM="auto"
      PS1+='\[\033[01;33m\]$(__git_ps1 " (%s)")\[\033[01;34m\] \$\[\033[00m\] '
   else
      PS1+='\[\033[01;34m\] \$\[\033[00m\] '
   fi
fi
PS2='> '
PS3='> '
PS4='+ '

case ${TERM} in
  xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'

    ;;
  screen)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
    ;;
esac

# source .bash_aliases if exist
[ -r ~/.bash_aliases ] && . ~/.bash_aliases

# source bash_completion if exist
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion

alias p='pwd'
alias dir='dir --color=auto'
alias ls='ls --all --color=auto'
alias ll='ls -l --human-readable --all --color=auto'
alias ltr='ls -lt --reverse --human-readable --all --color=auto'
alias grep='grep --color=auto'
alias dmesg='dmesg --color'
alias nano='nano -w'
alias x='exit'

in der Datei /etc/skel/.bashrc und /home/alarm/.bashrc alles auskommentieren
nano /etc/skel/.bashrc
nano /home/alarm/.bashrc

.bashrc

#
# ~/.bashrc
#

# If not running interactively, don't do anything
#[[ $- != *i* ]] && return

#alias ls='ls --color=auto'
#PS1='[\u@\h \W]\$ '