#!/bin/bash #appends the url in an m3u8 file echo "USAGE: m3u8dl.sh URL FOLDER NAME NEWNAME" url="" name="" folder="/tmp/mozilla_yannis0/" out="new.m3u8" if [ $# -gt 0 ]; then url=$1 if [ $# -gt 1 ]; then folder=$2 if [ $# -gt 2 ]; then name=$3 if [ $# -gt 3 ]; then out=$4 fi fi fi else exit 1 fi echo "reading: $name" echo "in folder $folder" echo "writing in $out" echo "appending $url" while read -r line do if [[ "$line" == "#"* ]];then echo "$line" >> $folder$out else echo "$url$line" >> $folder$out fi done < "$folder$name" echo "done"