Frankly, I am embarrassing myself for posting this piece of Bash. Initially, I wrote a one-liner to fill entire terminal space with checkerboard pattern, then I realized that I could shift a bit, that would look like as seen above, as if walking on checkerboard, hence the following code:
C=( $'\e[48;5;16m \e[48;5;231m \e[0m' $'\e[48;5;231m \e[48;5;16m \e[0m' $'\e[48;5;16m \e[48;5;231m \e[48;5;16m \e[0m' $'\e[48;5;231m \e[48;5;16m \e[48;5;231m \e[0m' ) i = 0 while :; do for ((y = 1; y <= LINES; y++)); do for ((x = 1; x <= COLUMNS / 4; x++)); do echo -n \ "${C[((i * 2) % 4) + ((y + i / 2) % 2)]}" done ((y == LINES)) || echo done sleep 0.25 ((i = ++i % 4)) && echo done
I wasn’t feeling to make it compact or clean. Since it’s already been written, I might just post it instead of stuffing it somewhere on disk that I would forget in just a few days.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.