#!/bin/bash set -e source ./common.sh fileList=$(mktemp) shuffleList=$(mktemp) ls -1 "${VIDEOS}/" > "${fileList}" rm -rf playlist.txt count=50 for i in $(seq $count); do cat "${fileList}" | shuf > "${shuffleList}" while read videoIn; do echo "file '${VIDEOS}/${videoIn}'" >> playlist.txt done < "${shuffleList}" done rm -f "${fileList}" rm -f "${shuffleList}"