Here I have a binary clock that displays a binary clock in 16 different colors, and I'm trying to make it appear in the center of the screen, but I canโt do it. If you have any suggestions on how to do this, please let me know. thank
color=("0;30" "0;31" "0;32" "0;33" "0;34" "0;35" "0;36" "0;37" "1;30" "1;31" "1;32" "1;33" "1;34" "1;35" "1;36" "1;37")
color2=${
while true;
do
clear
echo -ne '\e['${color[$((RANDOM%color2))]}m
hour=$(date +%H)
minute=$(date +%M)
second=$(date +%S)
hour_binary=$(echo "ibase=10;obase=2;$hour" | bc)
minute_binary=$(echo "ibase=10;obase=2;$minute" | bc)
second_binary=$(echo "ibase=10;obase=2;$second" | bc)
printf "%06d\n" "$hour_binary"
printf "%06d\n" "$minute_binary"
printf "%06d" "$second_binary"
sleep 1
done
source
share