Found a bash script that I wanted to alter as it wasn't working correctly but don't know enough to get it working and have been fumbling around the net with no luck.
The original bit below outputs the entire list in one got and does not iterate thru each item:
Code: Select all
startFile="$(ls -1 "${wallpaperDir}" | egrep -i "\.(png|jpg|jpeg|bmp|gif)$" | head -n 1)"
endFile="$(ls -1 "${wallpaperDir}" | egrep -i "\.(png|jpg|jpeg|bmp|gif)$" | tail -n 1)"
for line in "$(ls -1 "${wallpaperDir}" | egrep -i "\.(png|jpg|jpeg|bmp|gif)$")"; do
if [ $(echo "${line}" | grep -c "$endFile") -eq "1" ]; then
nextFile=$startFile
else
nextFile="$(ls -1 "${wallpaperDir}" | egrep -i "\.(png|jpg|jpeg|bmp|gif)$" | grep -A 1 "${line}" | tail -n 1)"
fi
echo "
<static>
<duration>${timeDisplay}</duration>
<file>${wallpaperDir}/${line}</file>
</static>
<transition>
<duration>${timeTransition}</duration>
<from>${wallpaperDir}/${line}</from>
<to>${wallpaperDir}/$nextFile</to>
</transition>" >> "${wallpaperDir}/background.xml"
echo -n "."
done
Code: Select all
filearray="(ls -1 "${Dir}" | egrep -i "\.(png|jpg|jpeg|bmp|gif)$")"
for line in "${filearray[@]}"; do