1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Check for an interactive session
[ -z "$PS1" ] && return
_PROMPT() {
_EXIT_STATUS=$?
[ $_EXIT_STATUS != 0 ] && _EXIT_STATUS_STR="\[\033[1;30m\][\[\033[1;31m\]$_EXIT_STATUS\[\033[1;30m\]] "
PS1="\033[1;30m\]» \[\e[0;33m\]fu\033[1;30m\]╺─╸$_EXIT_STATUS_STR\[\033[1;30m\][\[\033[0m\]\W\[\033[1;30m\]]\[\033[1;34m\];\[\033[0m\] "
unset _EXIT_STATUS_STR
}
PROMPT_COMMAND=_PROMPT
Result:
» fu╺─╸[~]; with the defined colors.
|
x
Notes
This is my PS1. It’s what shows when i open up urxvt. I have had requests from users to add notes on this dot' so instead i will add a screenshot of the result to make things a little more comprehensible.
Cheers.
rstrcogburn said about 13 years ago
creds for originality in prompt style
WyattEarp said about 12 years ago
really nice, man. What font is it, btw?
sohaeb said about 10 years ago
The code that dipilibupap gave us has a couple errors. It made my terminal text overlap and never goes to the new line.
EDIT: I found out that the website is causing these errors by removing some of the brackets
Here is the fixed version:
Check If Interarctive Session
[ -z “$PS1” ] && return
NameOfHost=‘fu’
blue=“[\033[1;34m]”
yellow=“[\e[0;33m]”
localGray=“[\033[1;30m]”
white=“[\033[0m]”
text=“[\033[0m]”
red=“[\033[1;31m]”
_PROMPT() {
_EXIT_STATUS=$?
[ $_EXIT_STATUS != 0 ] && _EXIT_STATUS_STR=“$localGray[$_EXIT_STATUS$localGray] ”
PS1=“$localGray»$yellow$NameOfHost$localGray╺─╸$_EXIT_STATUS_STR$localGrey[$white\W$localGray]$blue;$text ”
unset _EXIT_STATUS_STR
}
PROMPT_COMMAND=_PROMPT
edited about 10 years ago