
On Fri, Nov 11, 2011 at 09:47:10AM +1100, Matthew Cengia wrote:
On 2011-11-11 00:22, David Zuccaro wrote:
On Thu, 2011-11-10 at 13:16 +1100, Trent W. Buck wrote:
export TITLE=${TITLE:-unknown}
Why not: export TITLE=unknown
Because Trent's version lets you explicily set TITLE earlier (e.g. before invoking the script), if you want to override the default of 'unknown.'
yep. another minor variation is to write it something like the following, so that the script can take the default TITLE as the first ARG on the command line, defaulting to 'unknown' if not specified. export TITLE=${1:-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
Why the need for the -ls option?
Only for use as a type of progress indicator to see which file has just been processed.
it's hard to see any benefit in using find here, though. with -maxdepth 1, you may as well just use 'for filename in *.mp3; do...', and have a much easier to read script for filename in *.mp3 ; do id3ed -isq "$filename" id3ed -q -s "$TITLE${0:5:4}" "$filename" id3ed -isq "$filename" echo "$filename" done but don't mind me. i'm biased against using find's -exec and go out of my way to use xargs or for or anything else instead, because i think -exec further uglifies the already grotesque horror of shell quoting into something of almost Lovecraftian proportions - the mere sight likely to drive anyone insane. craig ps: i still think there are better tools then id3ed for this job. lltag, for instance. -- craig sanders <cas@taz.net.au> BOFH excuse #13: we're waiting for [the phone company] to fix that line