Published at LXer:
When I'm in a Linux terminal, I often find myself typing date just to see the time. To make life a bit easier, I wrote a script to always display a clock in the top right corner of the screen. The script saves the current cursor position with an ANSI escape sequence instruction. Then, using the tput command, the cursor is sent to row 0 (the top of the screen) and the last column minus 19 characters (19 is the length of HH:MM:SS YYYY-MM-DD). The formatted date command is displayed in green inverted color. The cursor is then sent back to its original position with another ANSI sequence that restores the original saved position.
Read More...