Advertisement
Guest User

prompt_gentoo_setup

a guest
Sep 3rd, 2011
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.76 KB | None | 0 0
  1. # gentoo prompt theme
  2.  
  3. prompt_gentoo_help () {
  4.   cat <<'EOF'
  5. This prompt is color-scheme-able.  You can invoke it thus:
  6.  
  7.   prompt gentoo [<promptcolor> [<usercolor> [<rootcolor>]]]
  8.  
  9. EOF
  10. }
  11.  
  12. prompt_gentoo_setup () {
  13.   prompt_gentoo_prompt=${1:-'blue'}
  14.   prompt_gentoo_user=${2:-'green'}
  15.   prompt_gentoo_root=${3:-'red'}
  16.  
  17.   if [ "$USER" = 'root' ]
  18.   then
  19.     base_prompt="%B%F{$prompt_gentoo_root}%m%k "
  20.   else
  21.     base_prompt="%B%F{$prompt_gentoo_user}%n@%m%k "
  22.   fi
  23.   post_prompt="%b%f%k"
  24.  
  25.   #setopt noxtrace localoptions
  26.  
  27.   path_prompt="%B%F{$prompt_gentoo_prompt}%1~"
  28.   PS1="$base_prompt$path_prompt %# $post_prompt"
  29.   PS2="$base_prompt$path_prompt %_> $post_prompt"
  30.   PS3="$base_prompt$path_prompt ?# $post_prompt"
  31. }
  32.  
  33. prompt_gentoo_setup "$@"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement