#!/bin/bash set -e cd shell-fm for file in *.mp3 ; do if ( id3v2 -l "$file" | grep -iq ': No ID3 tag$' ) ; then echo $file artist=${file%% - *} title=${file##* - } title=${title%.mp3} echo " - artist: $artist" echo " - title: $title" id3v2 --artist "$artist" --song "$title" "$file" fi done