simple bash script question

matthew nicholson sjoeboo at sjoeboo.com
Wed Jan 25 18:45:41 EST 2006


Dear fellow bostonians:

I'm in the middle of moving a whole slew of mp3s/.oggs to my freshly
modded xbox, however i've run into the snag of the xbox filesystem
(fatx) not liking certain charaters/filename lengths i have on my
desktop.

so, i of course went to the sheel to get what i needed done. however,
i'm stuck. i havea list of mp3s that have a ( or ) in the name (ala:
find /media/stuff/mp3s/ -iname "*\(*\)*.mp3" > list2"

and i have a another command : 

cat list2 | while read line; do line2=${line//\(/}; line3=${line2//\)/};
fline=${line//\ /\\ };fline3=${fline//\(/\\\(};fline4=${fline3//\)/\\
\)}; fline2=${line3//\ /\\ }; echo "mv $fline4 $fline2"; mv -v $fline4
$fline2; done;

that goes through each line in the file and reads it in to a variable,
rips out teh characters i want (in this case ( and) ) and escapes teh
spaces etc in teh resuling filename and original file anme, to be passed
t the mv command.

however, everytime i run this, mv, with every file, says:

mv: invalid option -- \
Try `mv --help' for more information.

BUT, i can copy the output of the command (it spits out the exact
command being exectued every time mv is called) and paste it into the
terminal, and, wham, it works. so, the syntax of what i'm passing to mv
is, from what i can tell, correct.

any ideas? better ways to do this?

thanks.

-- 
matthew nicholson <sjoeboo at sjoeboo.com>
sjoeboo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.blu.org/pipermail/discuss/attachments/20060125/bea7614e/attachment.sig>


More information about the Discuss mailing list