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: