Wpis z mikrobloga

Przerabiam skrypt bash. Jestem totalnie tępy w programowaniu. Skrypt służy do pobierania stron z archiwum Wayback Machine. Chcę, żeby każdy snapshot tworzył się w osobnym folderze. Skrypt niestety działa tak, że ładuje pliki ze wszystkich snapshotów do jednego folderu i nadpisuje. Jest linijka

while read line;do # For every file
rawcurrent="${line:1:${#line}-3}" #remove brackets from JSON line
IFS=', ' read -a current <<< "$rawcurrent" #separate timestamp and url
timestamp="${current[0]}"
originalurl="${current[1]}"
waybackurl="[http://web.archive.org/web/$timestamp"](http://web.archive.org/web/$timestamp")
waybackurl+="id_/$originalurl" #form request url
file_path="$domain/"
sufix="$(echo $originalurl | grep / | cut -d/ -f2- | cut -d/ -f3-)"
[[ $sufix = "" ]] && file_path+="index.html" || file_path+="$sufix" #determine local filename
clear
echo " $i out of $numoflines" #show progress
echo "$file_path"
mkdir -p -- "${file_path%/*}" && touch -- "$file_path" #make local file for data to be written
wget -N $waybackurl -O $file_path #download actual file
((i++))
done < list.json

Jest zmienna $timestamp. Chciałbym, żeby folder wyglądał $file_patch/$timestamp, ale nie wiem jak to zrobić :(
Skrypt jest dostępny tutaj https://gist.github.com/lazanet/872f88c9874e4a7a78fd

#programowanie #linux