bash prompt

Where is my PS1 defined?

When I chroot into my gentoo environment, PS1 is defined but I don't know where.

$ sudo chroot /mnt/gentoo
# echo $PS1
\[\033]0;\u@\h:\w\007\]\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\]
/ # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...
# echo $PS1
\[\033]0;\u@\h:\w\007\]\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\]

I greped but couldn't find where that PS1 was defined...

How to add the output of a command to the Bash prompt?

How to get the output of a command within the bash prompt?

I tried something simply like the following, but the time is not being updated. The times is obviously only calculated once, when PS1 is being evaluated:

$ PS1="$(date +%H:%M:%S) $ "
18:42:27 $
18:42:27 $
18:42:27 $
18:42:27 $
18:42:27 $
18:42:27 $
18:42:27 $ PS1="$(date +%H:%M:%S) $ "
18:42:45 $

How to make it so that the command is being evaluated each time?

I now I can use \t for the current time, but above is only an example. I actually want something like the following output:

Syndicate content