This question already has an answer here:

So I've been messing around with my prompt in bash, editing the primary prompt of bashrc, and I noticed that the \t parameter to display the current time as the prompt does not change unless you enter a command. Is it possible to have the time countdown, or make my prompt actually count, with one number appearing and the next replacing it say after 1 second?


EDIT: Well, I've managed to display a running clock in the terminal itself through a script. Can I insert this into a prompt? Can I insert commands or bash code into the prompt and have it run?

EDIT: Seems you can, but it won't run unless you actually enter a command, just like \t. Looks like my only solution is changing my terminal.

marked as duplicate by muru bash Dec 18 '16 at 17:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Check this : http://askubuntu.com/questions/360063/how-to-show-a-running-clock-in-terminal-before-the-command-prompt – ankit7540 Dec 17 '16 at 17:34
  • Not really the terminal, but the shell. Bash doesn't really do updating prompts without re-printing. Zsh can: askubuntu.com/a/360172/158442 – muru Dec 18 '16 at 17:56