A question about my bash prompt

P.B.S. avenger at vip.bg
Sat Apr 16 16:19:40 PDT 2005



First, please pardon me for my bad English.


So, this is my prompt:

PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '

I am not really versed in bash, but I surmise that "echo $?" should be the exit
code of the most recently executed command. In effect, it is always zero, even
when I'm sure the exit code is NOT 0.

What's the problem with it?

Maybe it is actually printing the exit code of "tput" which is always zero? If
that's the problem, maybe the value of "$?" should be saved first and then
echoed at the end?

Any suggestions?


More information about the freebsd-questions mailing list