I'm trying to make HAL 9000. I have a file that contains "dialog" from the movie,
and a wordlist that has words in EEPROM, at their respective memory locations, and chips where the words reside in memory. I wrote a bash script that reads the movie dialog, and should output the memory addresses, and chips. It seems to work when the words are longer than one letter. When the words are 1 letter (ie: i, a), it seems to output every instance where the letter is found in a word. The bash script:
#!/bin/bash
#Read dialog get the word on a line, then find the memory location and chip it is on
#rec_column2 is the address in the chip for the word
#cs=Chip Select, the value of rec_column3
#wordlist is the library xlsx converted via: for i in *.xlsx; do libreoffice --headless --convert-to csv "$i" ; done
#then put in all lower case because I don't know how to compare values that only differ by case
#command used: tr '[:upper:]' '[:lower:]' < input.csv > wordlist.csv
input="dialog"
while IFS= read -r line
do
while IFS="," read -r rec_column1 rec_column2 rec_column3
do
if test "$line" = "$rec_column1"
then
echo "// " $line " , " $rec_column1 " :: " $rec_column2 ", " $rec_column3
#echo "digitalWrite($rec_column3,LOW);"
#echo "SPI.transfer($rec_column2);"
#echo "digitalWrite($rec_column3,HIGH);"
#echo "delay(850);"
fi
done < wordlist.csv
done < $input
[
The wordlist, with memory locations is here.
The dialog for HAL 9000 is here.
so again, in the event the word is more than one letter, the script seems to work.
why does it check single letters against every word containing that letter? how do I not do that?