Hello,
I'm trying to match in a case statement based on file extension. Essentially, I want to do something different for .mp3 files and .ogg files.
I have this case statement:
Code:
case musicfile in
*.ogg\"$)
echo "Processing .ogg file"
;;
*.mp3\"$)
echo "Processing .mp3 file"
;;
*)
echo "Warning: Unexpected file type: " $musicfile
;;
esac
But this element always comes up in the default case, instead of the .ogg case:
"/home/testuser/gpodder-downloads/GNU World Order Linux OggCast/gnuWorldOrder_6x02.ogg"
The trailing double quote is necessary because this case statement is in a loop that processes on a list of files, which could contain spaces in the path, so I used awk to wrap each line in double quotes.
Essentially, I just want to see if the string ends in '.mp3"' or '.ogg"'. I am clearly missing something but every example I see uses trivial regular expression matches. Any suggestions?