0

My ~/.bash_profile contains this:

function rgb {
    # https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
    let "sum = 16 + 36*$1 + 6*$2 + $3"
    # echo "\[\e[${sum}m\]"
    tput setaf ${sum}
}

  BOLD=$(tput bold)
   DIM=$(tput dim)
 RESET=$(tput sgr0)

BRIGHT=$(rgb 5 5 5)
  BLUE=$(rgb 1 1 5)
YELLOW=$(rgb 4 4 1)

PS1="\n"
PS1+="\[${DIM}\]"
PS1+="\u@"
PS1+="\[${BRIGHT}\]"
PS1+="\h "
PS1+="\[${BLUE}\]"
PS1+="\w "
PS1+="\[${YELLOW}\]"
PS1+="\$(git_branch)"
PS1+="\n"
PS1+="\[${BRIGHT}\]"
PS1+="> "
PS1+="\[${BOLD}\]"

echo ${BOLD}

If I just execute the above as a separate foo.sh file, it leaves my bash window dim:

enter image description here

(Edit: Screenshot fail, . foo.sh behaves the same)

Even upgrading my bash version thru Homebrew fails to shift this.

What's going on?

1

Because your function told it to do so?

See wikipedia tput page, IBM tput tutorial & man tput

Google bash prompt & tput and you get quite a few suggestions on how to set up your prompt.

Comment out the function you posted in your ~/.bash_profile.
Start a new terminal. Things should be normal again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .