用Shell整理音樂檔 - Linux

Table of Contents

之前土法煉鋼,用rhythmbox一個個的改資訊

趁年假摸一下bash,現在想寫個sh來做這些動作

但遇到了變數的問題


i=0;
for list in *.mp3;
do i=$(($i+1));
id3 -T "$i" $list;
done

可是list歌單裡的歌名有空格,所以會出錯

因為檔名遇到空格要加\

目前卡在這裡



有試過用rename或sed來把$list檔名取代成有\的字串

但還沒成功,我想我跟本是想錯方向了

請給我個指示吧,謝謝

--

All Comments

Faithe avatarFaithe2011-02-12
easytag
John avatarJohn2011-02-12
id3 -T "$i" "$list";
Ina avatarIna2011-02-13
cut
Michael avatarMichael2011-02-15
... 不需要用到 cut ,bash 底下用 ${name:location} 就可
Eden avatarEden2011-02-17
ex: echo ${USER:1} 就跳掉第一個 char
Isla avatarIsla2011-02-19
How about "Shell script string manipulation"
我找到這個, 裡面有解答 http://goo.gl/v06M7
Joseph avatarJoseph2011-02-24
不過我遇到這種都直接請出 Python 大神比較簡單XD
Ida avatarIda2011-02-26
大蟒蛇一票...
Delia avatarDelia2011-03-02
man bash 找 string