Re: bash scripts misrepresenting white space
On Thu, 2003-12-25 at 21:32, Johann Koenig wrote:
> I tried reading the man page and the BASH Programming HOWTO, but I
> couldn't really get what I needed out of either. Oh well, with you're
> example to guide me, I got it right. If anybodies willing, please look
> over the attached script and give any comments that come to mind.
>
> About the script: It runs in the current directory and converts all
> flacs to mp3s. I'm figuring I could wrap it in another script to
> transverse my directory tree, running the conversion script in each one.
> I tried to make it as modular as possible, but I may have gone a little
> overboard.
You might be better off doing this in a scripting language like Perl. Your script would be a lot simpler and you wouldn't have to worry about such annoyances as quoting. There are a zillion modules to easily parse filenames and such...
Dan
--- E.g.: ---
#!/usr/bin/perl
open(FLACS, "find . -name '*.flac' |");
while ( <FLACS> ) { push @FLACS, $_; }
close FLACS;
foreach (@FLACS) {
&decode($_);
}
sub decode
{
my $file = shift;
system('flac', '-dc', $file);
}
Reply to: