LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   display time in the prompt (http://www.linuxquestions.org/questions/linux-general-1/display-time-in-the-prompt-324660/)

rpb 05-18-2005 08:33 AM

display time in the prompt
 
hi,

the following string displays time in the prompt:

set prompt = "%{\033[29m%}%B[%@]$ "

as follows:

[7:04pm]$

now i want the time in 24 hours format, without any am, pm etc. that is, say

[19:04]$

anybody knows how?

thanks,
rpb

bigrigdriver 05-18-2005 04:03 PM

The answer can be found in the Bash Prompt HOWTO. Change %@ to %t (or possibly \t as in the HOWTO) for time in 24 hour format.


All times are GMT -5. The time now is 01:15 AM.