robsite

In terminal

Terminal Red Line

Um Befehle besser zu trennen und eine schöne rote Linie über die gesamte Breite des Terminals zu malen, mit Pfad darunter:

COLUMNS=$(tput cols)
RED='\[\e[1;31m\]'
RESET='\[\e[0m\]'
export PS1="\[\e]2;\w\a$RED\`for (( i=0 ; i < \"\$COLUMNS\";i++)) ; do echo -n '_'; done\`\n$RED\$PWD)$RESET "

In .bash_profile oder .bashrc packen.

Für ZSH in .zshrc (nach 4 Fragen übersetzt von GPT-4 🤯):

COLUMNS=$(tput cols)
RED=$'\e[1;31m'
RESET=$'\e[0m'

# Generate the red line
red_line() {
  for (( i=0 ; i < $COLUMNS; i++ )); do
    echo -n '_'
  done
}

# Set the prompt with the current working directory
PROMPT="${RED}%d)${RESET} "

# Use precmd to print the red line before the prompt
precmd() {
  echo -n "${RED}$(red_line)${RESET}"
  echo
}
Bild eines macOS Terminals mir roter Linie
· chatgpt, command line, linux, macOS, terminal · ★
Mastodon