my prompt and my issue

שָׁלוֹם

cat /etc/issue

 _____        _
|  ___|__  __| | ___  _ __ __ _  Release: 10 (Cambridge)
| |_ / _ \\/ _` |/ _ \\| '__/ _` | Kernel: \r
|  _|  __/ (_| | (_) | | | (_| |
|_|  \\___|\\__,_|\\___/|_|  \\__,_| Terminal: \l

Result:
Nothing special
Fedora Login ASCII

excerpt of /etc/bashrc (above PS1 definition)

# Colors
normal=''
bold=''
black=''
darkgrey=''
red=''
lightred=''
green=''
lightgreen=''
brown=''
brown=''
blue=''
lightblue=''
violet=''
lightviolet=''
cyan=''
lightcyan=''
lightgrey=''
white=''

# define pwd
function show_pwd()
{
echo -e ${PWD////${normal}${bold}/${normal}${blue}}
}

excerpt of /etc/bashrc in the PS1 definition

    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1='${bold}.:[${normal} ${green}\u${normal} ${bold}@${normal} ${red}\h${normal} ${bold}:${normal} ${blue}$(show_pwd)${normal} ${bold}]:.${normal}\n\$ '

Result:(in an Gnome-Terminal)
The specialty of this (in comparison to other prompt-templates in the web) is that the seperator is colored in a different color than the direcory. :-) You can select another seperator if you want. :-)
Screenshot Gnome Terminal

So long and thanks for all the fish :-)
שִׁמְעוֹן

Tags: , ,

Eine Antwort zu “my prompt and my issue”

  1. kjk sagt:

    It’s usually better to use `tput` setaf/sgr0/bold instead of raw codes.

Hinterlasse eine Antwort