#!/bin/bash set -eu tag="$1" today=`date +"%Y%m%d"` visitedDir="$HOME/.bandcamping/visited" visited="$visitedDir/$today" likedDir="$HOME/.bandcamping/liked" liked="$likedDir/$today""_$tag" mkdir -p "$visitedDir" mkdir -p "$likedDir" touch "$visited" { curl "https://bandcamp.com/tag/$tag?tab=all_releases&s=random" 2>/dev/null | grep -oP "https://[a-zA-Z0-9\-äöü]*?.bandcamp.com/album/.*?(?=")" | while read album; do if grep -rq "$album" "$visitedDir"; then continue fi echo "$album" surf "$album" echo -n "Like? " read -u 3 like if [ "$like" == "y" ]; then echo "$album" >> "$liked" echo "added to $liked" fi echo "$album" >> "$visited" done; } 3<&0