
David Zuccaro wrote:
Anyone like to critique this script for grammatical efficiency and correctness? In particular the line indicated. I'm guessing I can do command substitution better than this.
title="test" ls -1 *.mp3 > mp3.txt while read filename do echo $filename song=$title${filename:5:4} echo $song id3ed -isq "`echo $filename`" id3ed -q -s "`echo $song`" "`echo $filename`" <---- id3ed -isq "`echo $filename`" done < mp3.txt
export TITLE=${TITLE:-unknown} find -iname \*.mp3 -maxdepth 1 \ -exec bash -xc 'id3ed -isq "$0"' {} \; \ -exec bash -xc 'id3ed -q -s "$TITLE${0:5:4}" "$0"' {} \; \ -exec bash -xc 'id3ed -isq "$0"' {} \; \ -ls Using :5:4 seems a little optimistic, I would recommend instead e.g. $ x=foo-bar-baz.mp3 $ y=${x%.mp3}; a=${y%%-*} c=${y##*-} b=${y%-*}; b=${b#*-} $ echo $a, $b, $c foo, bar, baz