Created
November 16, 2021 10:09
-
-
Save ozcanyarimdunya/ed8e68cf4a1ab50808de5da5d533dace to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
letters=('A' 'B' 'C') | |
line1=('oxxo' 'xxxx' 'xxxx') | |
line2=('xoox' 'xoox' 'xooo') | |
line3=('xxxx' 'xxxo' 'xooo') | |
line4=('xoox' 'xoox' 'xooo') | |
line5=('xoox' 'xxxx' 'xxxx') | |
read -a input_name -p "Enter your name (uppercase and space between ex: O Z C A N): " | |
read -a input_char -p "Enter char [*]: " | |
input_char=${input_char:-*} | |
function print_me() { | |
arr=("$@") | |
string="" | |
for i in ${input_name[@]} ; do | |
c=0 | |
for letter in ${letters[@]} ; do | |
if [ $letter == $i ]; then | |
string+="${arr[c]} " | |
break | |
fi | |
((c=c+1)) | |
done | |
done | |
echo "${string}" | sed "s/o/ /g" | sed "s/x/${input_char}/g" | |
} | |
print_me ${line1[@]} | |
print_me ${line2[@]} | |
print_me ${line3[@]} | |
print_me ${line4[@]} | |
print_me ${line5[@]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment