This script does not work in lakka (solved)

Try this script. It works for me under shell (sh) so hopefully it would work on your Lakka install also.

#!/bin/bash

#set -x

IFS=';'

rm Favorites.txt

ls -- *.tag > tagfiles
while read -r filename
do
  while read -r gamename
  do
    romlist=$(echo "${filename}" | cut -f1 -d '.')
    gamename="${gamename/$'\r'/}"
    grep "^${gamename};" "${romlist}.txt" >> Favorites.txt
  done < "${filename}"
done < tagfiles

rm tagfiles
cat Favorites.txt | sort -u Favorites.txt > tmp_favorites.txt
mv tmp_favorites.txt Favorites.txt

Thanks for your help. This script of yours and the previous one, both worked in sh, in libreElec, which is where lakka is born, but in lakka they do not work. It’s something amazing.

I’ve already asked in another thread, but nobody has looked at it. I’ll have to raise it on github, in case it’s a lakka bug.