Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [DE] Probleme mit der .bashrc  (Read 1337 times)

Offline rohdimus

  • Newbie
  • Posts: 4
[DE] Probleme mit der .bashrc
« on: 2025/11/10, 12:20:13 »
Ich habe Problme mit meiner eigenen .bashrc. Diese müßte an die Terminals von KDE und Gnome, je an den Standard angpasst werden diese ist 2 Jahre alt. ich wollte auf shopt verzichten

Besonders der Farbbereich bereitet Probleme. Könnt Ihr mir helfen die Bugs zu beseitigen?

Das Listing: .bashrc User Variante. Die Root Variante ist bis auf einen Zeileneintrag im bereich des Aliases und 2 Zeichen dieselbe.
---------------------------------------------------------------------------------------------------------------------------------------------
# ~/.bashrc: executed by bash(1) for non-login shells.

HISTSIZE=15
HISTFILESIZE=15

alias ls='ls --group-directories-first -alF '
alias cls='clear'
alias devicelist="lsblk -fs"

export PS1="\e[1;4;0;36m[\e[1;32m\h\e[49;1;33m://\e[1;32m\u\e[1;33m(\w)\e[1;4;0;36m]\e[0;34m:> \e[0m"

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
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
----------------------------------------------------------------------------------------------------------------------------------

Offline Penyelam

  • User
  • Posts: 262
Re: Probleme mit der .bashrc
« Reply #1 on: 2025/11/10, 21:53:35 »
versuch das mal. Erstellt von chatGPT  :)
Code: [Select]
# ~/.bashrc: executed by bash(1) for non-login shells.

# History-Einstellungen
HISTSIZE=1000
HISTFILESIZE=2000

# Nützliche Aliase
alias ls='ls --group-directories-first --color=auto -alF'
alias cls='clear'
alias devicelist='lsblk -fs'

# Farbige Prompt-Definition
# (nutzt \[...\] für nicht druckbare Escape-Sequenzen, wichtig für Zeilenumbrüche)
if [[ $EUID -eq 0 ]]; then
    # Root-Prompt (rot)
    PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '
else
    # User-Prompt (grün/blau)
    PS1='\[\e[1;36m\][\[\e[1;32m\]\h\[\e[1;33m\]:\[\e[1;32m\]\u\[\e[1;33m\](\w)\[\e[1;36m\]]\[\e[0;34m\]:> \[\e[0m\]'
fi

# Terminal-Titel für unterstützte Terminals (KDE, GNOME, xterm, etc.)
case "$TERM" in
    xterm*|rxvt*|konsole*|gnome-terminal*)
        PS1="\[\e]0;\u@\h: \w\a\]$PS1"
        ;;
esac

# Farbige GCC-Warnungen
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# Bash Completion (automatisch aktiviert, falls vorhanden)
if [ -r /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
elif [ -r /etc/bash_completion ]; then
    . /etc/bash_completion
fi


Offline rohdimus

  • Newbie
  • Posts: 4
Re: Probleme mit der .bashrc
« Reply #2 on: 2025/11/10, 22:00:26 »
Werde ich mal durch testen.

Offline rohdimus

  • Newbie
  • Posts: 4
Re: Probleme mit der .bashrc
« Reply #3 on: 2025/11/11, 17:39:10 »
ChatGpt schein gut zu sein. Ich bin begeistert. Übernehme ich 1:1. Eine Abänderung werde ich durchführen sonnst behalte ich diese Datei so wie sie ist.