Last active
May 2, 2017 12:25
-
-
Save komasaru/789216cf9cf5e1aa339c to your computer and use it in GitHub Desktop.
Bash script to control cursor position.(Ex.2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Clear the screen | |
tput clear | |
# Write a frame | |
echo | |
echo " +---------------------+" | |
echo " | |" | |
echo " +---------------------+" | |
echo | |
# Set font | |
tput setb 1 | |
tput setf 6 | |
tput bold | |
# Output date and time | |
for i in {0..4}; | |
do | |
sleep 1 | |
tput cup 2 4 | |
echo -n `date +"%Y-%m-%d %H:%M:%S"` | |
done; | |
tput cup 2 4 | |
echo -n `date +"%Y-%m-%d %H:%M:%S"` | |
# Move the cursor position | |
tput cud 2 | |
echo | |
# Reset tput setting | |
tput init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment