Skip to content

Instantly share code, notes, and snippets.

@komasaru
Last active May 2, 2017 12:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komasaru/789216cf9cf5e1aa339c to your computer and use it in GitHub Desktop.
Save komasaru/789216cf9cf5e1aa339c to your computer and use it in GitHub Desktop.
Bash script to control cursor position.(Ex.2)
#!/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