UNIX Display current time in the prompt:
------------------------------ ----------------
In the PS1 environment variable, you can directly execute any Linux command, by specifying in the format $(linux_command). In the following example, the command "date" is executed to display the current time inside the prompt.
devaraj#export PS1="\u@\h [\$(date +%H:%M:%S)]# "
------------------------------
In the PS1 environment variable, you can directly execute any Linux command, by specifying in the format $(linux_command). In the following example, the command "date" is executed to display the current time inside the prompt.
devaraj#export PS1="\u@\h [\$(date +%H:%M:%S)]# "
devaraj@my-serv [14:12:35]#
devaraj@my-serv [14:12:35]# date
Sun Sep 23 14:12:37 IST 2012
devaraj@my-serv [14:12:35]# date
Sun Sep 23 14:12:37 IST 2012
No comments:
Post a Comment