I cannot find a way to use omxplayer in a shell script to play videos in a folder in a random "shuffle" order. I would like it to loop through a "playlist" but so far I have only been able to find a way to play all folders in alphabetical order in a loop. I use a version of the code below for the loop.
#!/bin/sh
# get rid of the curso so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
VIDEOPATH="/home/pi/Videos"
# you can normally leave this alone
SERVICE="omxplayer"
# now for our infinite loop!
while true; do
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
sleep 1;
else
for entry in $VIDEOPATH/*
do
clear
omxplayer $entry > /dev/null
done
fi
done