|In the original version, the cursor positioning didn't work on my Mac OS X system. If that happens to you, try this simplified variant: |
#!/bin/bashAlso, note that you'll need to run either script in the background to use your terminal.
tput cup 0 60
echo -en `date +"%H:%M:%S %F"`
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.