My code looks like this
foo=`cat $words`
for (( i=0; i<${#foo}; i++ )); do
new=${foo:$i:1}
while IFS=read -r line
do
if [[ $new=="#" ]]
then
echo "<rect x="20" y="20" fill="black" />"
elif [[ $new==[A-Z] ]]
then
echo "<rect x="20" y="20" fill="white" />"
fi
done < "$new"
done
I get an error message containing the following
crossword: line 21: F: No such file or directory
2 crossword: line 21: G: No such file or directory
3 crossword: line 21: #: No such file or directory
4 crossword: line 21:
5 : No such file or directory
6 crossword: line 21: Z: No such file or directory
7 crossword: line 21: #: No such file or directory
8 crossword: line 21: E: No such file or directory
9 crossword: line 21:
My desired output should have looked like this
<rect x="20" y="20" fill="white" />
<rect x="20" y="20" fill="white" />
<rect x="20" y="20" fill="black" />
<rect x="20" y="20" fill="white" />
<rect x="20" y="20" fill="black" />
<rect x="20" y="20" fill="white" />
Because the content of the file is
FG#
Z#E
Where # will be replaced by black and the letters with white