Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: iOtero on February 11, 2019, 01:11:30 PM
-
This script works perfectly in raspbian and in ubuntu, but not in lakka:
#!/bin/bash
IFS=';'
cd /storage/.attract/romlists
rm Favorites.txt
touch Favorites.txt
chmod 777 Favorites.txt
ls *.tag > tagfiles
while read filename
do
while read gamename
do
romlist=`echo ${filename} |cut -f1 -d '.'`
cat "${romlist}.txt"|grep "^${gamename};" >> Favorites.txt
done < "${filename}"
done < tagfiles
rm tagfiles
cat Favorites.txt |sort -u > tmp_favorites.txt
mv tmp_favorites.txt Favorites.txt
sleep 5
The reading of the data is correct, but the redirection >> does not do anything.
In putty ssh this comand runs:
cat "Atari2600.txt" |grep "Centipede (USA)" >> Favorites.txt
but the script does not.
Does anyone know why?
-
How strange, nobody has answered me ... 8)
I already do it myself: you had to convert windows files to linux files, to put it in some simple way. :-[
-
Issue with line returns?
-
Issue with line returns?
I do not know exactly, but i think it has to do with the format of the tags, that you have to pass it from dos to linux.
Before executing the script, you must execute:
dos2unix *.tag
And then, it works...
-
It is indeed the line return.
Carriage Return (commodore, early Mac and dos)
Line Feed (Unix)
End Of Line (EOL/CRLF) combines both for best compatibility
Dos2unix tool should make sense now. Parameter you passed will make the tool parse each file in the current path ending with .tag
Try to create new files CRLF. Sometimes I make this simple mistake, using if I’m starting using some one else’s file as a base.
Edit: try something like this to write to file:
echo -e “line1/r/nline2†>> test.txt
-
You know what i think, Keil: If something works, do not touch it. 8)
And my script, now works fine... ;D