McTRASH692

. bash_prompt

Aug 31st, 2021
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.81 KB | None | 0 0
  1. # Define some basic colors using tput (8-bit color: 256 colors)
  2. red="\[$(tput setaf 160)\]"
  3. bright_red="\[$(tput setaf 196)\]"
  4. light_purple="\[$(tput setaf 60)\]"
  5. orange="\[$(tput setaf 172)\]"
  6. blue="\[$(tput setaf 21)\]"
  7. light_blue="\[$(tput setaf 80)\]"
  8. magenta="\[$(tput setaf 162)\]"
  9. hot_pink="\[$(tput setaf 200)\]"
  10. violet="\[$(tput setaf 171)\]"
  11. bold="\[$(tput bold)\]"
  12. start_underline="\[$(tput smul)\]"
  13. end_underline="\[$(tput rmul)\]"
  14. reset="\[$(tput sgr0)\]"
  15.  
  16. # Define basic colors to be used in prompt
  17. ## The color for username (light_blue, for root user: bright_red)
  18. username_color="${reset}${bold}${light_blue}\$([[ \${EUID} == 0 ]] && echo \"${bright_re            >
  19. ## Color of @ and ✗ symbols (orange)
  20. at_color=$reset$bold$orange
  21. ## Color of host/pc-name (blue)
  22. host_color=$reset$bold$blue
  23. ## Color of current working directory (light_purple)
  24. directory_color=$reset$light_purple
  25. ## Color for other characters (like the arrow)
  26. etc_color=$reset$red
  27. # If last operation did not succeded, add [✗]- to the prompt
  28. on_error="\$([[ \$? != 0 ]] && echo \"${etc_color}[${at_color}✗${etc_color}]─\")"
  29. # The last symbol in prompt ($, for root user: #)
  30. symbol="${reset}${bold}${bright_red}$(if [[ ${EUID} == 0 ]]; then echo '#'; else echo '$            >
  31.  
  32. ## Colour of date
  33. date_colour="$reset$bold$magenta"
  34. ## Colour of time
  35. time_colour="$reset$bold$violet"
  36.  
  37.  
  38.  
  39. # Setup the prompt/prefix for linux terminal
  40.  
  41. PS1="${etc_color}┌─${on_error}[";
  42. PS1+="${username_color}\u";
  43. PS1+="${at_color}@";
  44. PS1+="${host_color}\h"
  45. PS1+="${etc_color}]-[";
  46. PS1+="${directory_color}\w";
  47. PS1+="${etc_color}]\n└──╼ ";
  48. PS1+="${date_colour}\D{%d-%m-%Y}";
  49. PS1+="${time_colour}\A";
  50. PS1+="${etc_color}\n    └──╼ ";
  51. PS1+="${symbol}${reset}";
  52.  
  53. ## \u=Working directory
  54. ## \n=New Line
  55. ## \u=Username
  56. ## \h=Host
  57. ## \D{%d-%m-%Y}=Date
  58. ## \A=time
  59.  
  60.  
  61. export PS1
Advertisement
Add Comment
Please, Sign In to add comment