I'd like to sort my figlet fonts with testing, so I've decided to make a script, which will demonstrate figlet font one by one and will delete fonts I don't like. I've tried to find the solution for correct if-then condition inside while loop, but couldn't find one. Here's the script itself, but for now it just provides examples of all the fonts in the single scroll:
#!/bin/bash
#script to test figlet fonts
rm /usr/share/figlet/list.txt #delete old list
ls /usr/share/figlet > /usr/share/figlet/list.txt #create new list
filename='/usr/share/figlet/list.txt'
n=1
while read line; do
figlet -f $line Figlet
echo -e "Press 0 if you don't like it, font will be deleted"
read decision
if [ "$decision" = "0" ]; then
rm "/usr/share/figlet/$line"
echo -e "Font deleted"
else
echo -e "Font saved"
fi
n=$((n+1))
done < $filename