Last active
May 7, 2024 13:21
-
-
Save lostsh/46a2fc3d74ec82256e51ca0c30fe2fd2 to your computer and use it in GitHub Desktop.
[ARCHIVED] Display current datetime in french condensed format.
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
COL="\033[0;31m" | |
RST="\033[0m" | |
numbers=(\ | |
"\n ██████╗ \n██╔═████╗\n██║██╔██║\n████╔╝██║\n╚██████╔╝\n ╚═════╝ \n" \ | |
"\n ██╗ \n ███║ \n ╚██║ \n ██║ \n ██║ \n ╚═╝ \n" \ | |
"\n██████╗ \n╚════██╗ \n █████╔╝ \n██╔═══╝ \n███████╗ \n╚══════╝ \n" \ | |
"\n██████╗ \n╚════██╗ \n █████╔╝ \n ╚═══██╗ \n██████╔╝ \n╚═════╝ \n" \ | |
"\n██╗ ██╗ \n██║ ██║ \n███████║ \n╚════██║ \n ██║ \n ╚═╝ \n" \ | |
"\n███████╗ \n██╔════╝ \n███████╗ \n╚════██║ \n███████║ \n╚══════╝ \n" \ | |
"\n ██████╗ \n██╔════╝ \n███████╗ \n██╔═══██╗\n╚██████╔╝\n ╚═════╝ \n" \ | |
"\n███████╗ \n╚════██║ \n ██╔╝ \n ██╔╝ \n ██║ \n ╚═╝ \n" \ | |
"\n █████╗ \n██╔══██╗ \n╚█████╔╝ \n██╔══██╗ \n╚█████╔╝ \n ╚════╝ \n" \ | |
"\n █████╗ \n██╔══██╗ \n╚██████║ \n ╚═══██║ \n █████╔╝ \n ╚════╝ \n") | |
chars=(\ | |
"\n ██╗ \n ██╔╝ \n ██╔╝ \n ██╔╝ \n ██╔╝ \n ╚═╝ \n" \ | |
"\n \n ██╗ \n ╚═╝ \n ██╗ \n ╚═╝ \n \n" \ | |
"\n \n \n \n \n \n \n") | |
show_datetime () { | |
let size=$(echo "$1" | wc -c)-1 | |
#boder top | |
echo -ne "$COL ╔"; for c in $(seq 1 $(($size*9 + 2))); do echo -ne "═"; done; echo "╗"; | |
for i in $(seq 1 6); do # six is the height of a char | |
echo -ne " ║ $RST" | |
for j in $(seq 1 $size); do | |
num=$(echo $1 | cut -c $j) | |
case $num in | |
"/") echo -n "$( echo "${chars[0]}" | cut -d'n' -f$(($i+1)) | sed -e 's/\\//g')" ;; | |
":") echo -n "$( echo "${chars[1]}" | cut -d'n' -f$(($i+1)) | sed -e 's/\\//g')" ;; | |
" ") echo -n "$( echo "${chars[2]}" | cut -d'n' -f$(($i+1)) | sed -e 's/\\//g')" ;; | |
*) echo -n "$( echo "${numbers[$num]}" | cut -d'n' -f$(($i+1)) | sed -e 's/\\//g')";; | |
esac | |
done | |
echo -e " $COL║" | |
done | |
#boder bottom | |
echo -n " ╚"; for c in $(seq 1 $(($size*9 + 2))); do echo -ne "═"; done; echo -e "╝$RST"; | |
} | |
show_datetime "$(date +%d/%m\ %H:%M)" |
Author
lostsh
commented
Oct 29, 2021
•
Customize .bashrc
To add the date and time when your console launches, you can add the date display function to your bashrc. To do this you just need to:
- add the function from the snippet above at the end of the
.bashrc
file - add the following line at the end :
show_datetime "$(date +%d/%m\ %H:%M)"
Now you can enjoy 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment