I have been trying to get this script to work properly and I have nearly given up. That is why I thought I would post here for some help. This is not my script, I found it on the internet and have tried to adapt it to my needs but am not having to much luck. I know there is some extra stuff in the script that I don't need but it runs sort of? I am not a scripter or coder by any means, getting a bit too old for that I think. The script runs but what I would like it to do is output to a text file in my home directory. It outputs now but the results are not in alphabetical order and I would like all the Artists to be printed from A-Z if this is possible. This script is going to scan my music library and retrieve the replaygain data from all of the flac tags. The reason I am trying to do this is because I am trying to use replay gain values to pick out tracks that are possibly clipped so I don't have to open every single file in audacity one by one. I have had about %60-%70 percent in being able to pick files that have some clipping on them. Unless someone has a better idea or a better way. I have around 700gig of flac files to check, so this will take awhile. Anyway here is the script and I hope someone can help sort this mess out. I thank all of you for any kind help in advance, I really appreciate it.
if [ ! -d "$1" ]
echo "Arg "$1" is NOT a directory!"
flacnum=`ls "$1" | grep -c \\.flac`
if [ $flacnum -lt 1 ]
echo $1" (No FLAC files, moving on)"
echo $1" ("$flacnum" FLAC files)"
echo "Tag values:"
flacfiles=`ls -1 "$1"/*.flac`
for file in $flacfiles
if [ ! -e "$file" ]
echo "Error: file "$file" not found."
metaflac --show-tag=ARTIST --show-tag=TITLE --show-tag=REPLAYGAIN_TRACK_GAIN --show-tag=REPLAYGAIN_ALBUM_GAIN --show-tag=REPLAYGAIN_ALBUM_PEAK "$file"