Sample Header Ad - 728x90

time in bash prompt does not change over time

0 votes
2 answers
83 views
I changed the prompt in my .bashrc to show the current time. This was the original prompt (from a fresh MX Linux install)
PS1="$PURPLE\u$nc@$CYAN\H$nc:$GREEN\w$nc\\n$GREEN\$$nc "
and I changed it to this
PS1="$PURPLE\u$nc@$CYAN\H$nc $YELLOW$(date '+%Y-%m-%d %H:%M:%S')$nc $REEN\w$nc\\n$GREEN\$$nc "
When I open a terminal, I see the current date and time in the prompt. New prompts are not displayed with the time at which they are generated. They always show the same time as the first prompt. What am I doing wrong? enter image description here
Asked by crantok (124 rep)
Mar 6, 2025, 12:32 PM
Last activity: Mar 6, 2025, 06:18 PM