IP

LINUX HACK 33

Hack 33. PROMPT_COMMAND



Bash shell executes the content of the PROMPT_COMMAND just before displaying the PS1 variable.


ramesh@dev-db ~> export PROMPT_COMMAND="date +%k:%m:%S"

22:08:42 ramesh@dev-db ~>


[Note: This displays the PROMPT_COMMAND and PS1 output on different lines]


If you want to display the value of PROMPT_COMMAND in the same line as the PS1, use the echo -n as shown below.



ramesh@dev-db ~> export PROMPT_COMMAND="echo -n [$(date

+%k:%m:%S)]"


[22:08:51]ramesh@dev-db ~>


[Note: This displays the PROMPT_COMMAND and PS1 output on the same line]

0 comments:

Post a Comment