Last active
March 20, 2019 21:10
-
-
Save mostafaasadi/f52b0b5eda30d1a91e488873a8d99f7c to your computer and use it in GitHub Desktop.
happy new year shell
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 | |
# GPL | |
# A fork from https://github.com/subins2000/new-year-bash | |
# Config | |
name='Mostafa Asadi' | |
correction=0 | |
trap "tput reset; tput cnorm; exit" 2 | |
clear | |
tput civis | |
line=2 | |
middle_column=$(($(tput cols) / 2)) | |
middle_column=$((middle_column-1)) | |
color=0 | |
new_year=1397 | |
let new_year++ | |
while true; do | |
randomValue=$((RANDOM % 10 + 1)) | |
from_middle=$((middle_column-randomValue)) | |
column=$((RANDOM % (randomValue) * 2 + 1 + from_middle)) | |
tput setaf $color; tput bold | |
tput cup 1 $column | |
echo '*' | |
color=$(((color+1)%8)) | |
from_middle=-2 # from left column | |
for l in H A P P Y | |
do | |
tput cup $((line+1)) $((middle_column+from_middle)) | |
echo $l | |
let from_middle++ | |
sleep 0.01 | |
done | |
from_middle=-1 | |
for l in N E W | |
do | |
tput cup $((line+2)) $((middle_column+from_middle)) | |
echo $l | |
let from_middle++ | |
sleep 0.01 | |
done | |
from_middle=0 | |
for l in Y E A R | |
do | |
tput cup $((line+3)) $((middle_column+from_middle)) | |
echo $l | |
let from_middle++ | |
sleep 0.01 | |
done | |
spaceCount=$((middle_column/10 + correction)) | |
spaces="" | |
for (( c=1; c<=$spaceCount; c++ )) | |
do | |
spaces+=" " | |
done | |
tput cup $((line+4)) 1 | |
toilet "${spaces}$new_year" --gay -t | |
tput setaf $color; tput bold | |
tput cup 14 $column | |
echo '*' | |
tput cup $((line+15)) $((middle_column-(${#name}/3))) | |
echo $name | |
done |
or
brew install toilet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requirement
install toilet
sudo apt install toilet
or
yaourt -S toilet
or
brew install toilet
Usage