0

I am trying to add the current time to my bash in Redhat. I'd like it to read:

[user@hostname 01:01:01 ~] and obviously be relative to when the bash prompt was placed there.

Any ideas if this is possible, and if so, how?

Sugitime
  • 415
  • 1
  • 4
  • 12

1 Answers1

1

Did you try the PROMPT_COMMAND found here?

PROMPT_COMMAND="echo -n \[\$(date +%H:%M:%S)\]"
PS1=" "$PS1"\[\e]30;\u@\h\a\]"

Bear in mind that it won't give the time stamp for the current command, but the one before.

Petter H
  • 3,443
  • 1
  • 16
  • 19