FOLDER="segs" SEGMENTS=$(ls $FOLDER/seg*.ts) for SEGMENT in $SEGMENTS; do echo $SEGMENT ffmpeg -i $SEGMENT $SEGMENT.ogg done