Last active
April 21, 2022 14:41
-
-
Save Blokyk/e5c2f162d2dfc14b7b2abc4a4e172189 to your computer and use it in GitHub Desktop.
display_clock
This file contains 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 | |
function center_txt() { | |
txt=$1 | |
line_nb=$(wc -l <<< $txt) | |
available_lines=$(($(($LINES - $line_nb)) / 2)) | |
#echo $available_lines | |
#echo "$txt" | |
perl -E "say \"\n\" x $available_lines" | |
#echo $top | wc -l | |
echo "$txt" | |
perl -E "say \"\n\" x $available_lines" | |
} | |
export -f center_txt | |
if [[ "X$1" = "X" ]]; then | |
export FONT="ANSI Shadow" | |
else | |
FONT="$1" | |
fi | |
export FONT | |
function prnt() { | |
center_txt "$(date "+%H : %M : %S" | figlet -ctf "$FONT" && date "+%a. %d %b %Y" | figlet -ctf Small)" | |
} | |
export -f prnt | |
watch -n 1 -x bash -c prnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment