Created
August 24, 2021 20:20
-
-
Save sergei-mironov/752ee7290c1e4d6d85668d0a871e7442 to your computer and use it in GitHub Desktop.
chess.sh
This file contains hidden or 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/sh | |
# https://helloacm.com | |
H=`stty size | awk '{print $1}'` | |
W=`stty size | awk '{print $2}'` | |
for i in $(seq 1 $H) | |
do | |
for j in $(seq 1 $W) | |
do | |
S=$(((i+j)%2)) | |
if [ $S -eq 0 ] | |
then | |
echo -n "[47m " # white | |
else | |
echo -n "[40m " # black | |
fi | |
done | |
echo -n "[40m" # black, ensure it exists normally | |
echo "" # new line | |
done | |
echo H $H W $W |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment