I have mp3 files of the form "Artist - Song.mp3" I create a directory for the artist, strip the artist's name from the mp3, and move the mp3 into the artist directory. Everything except for stripping the artist's name works.
#!bin/bash
for f in *.mp3
do
  artist="${f%-*}"                   #works
  song="${f%*-}"                     #Should work but it doesn't
  mkdir -m 700 ~/home/music/$artist; 
  mv "$song" ~/home/music/$artist    
  echo "artist: $artist"
  echo "song: $song"
done
 
    