分页: 2 / 2

发表于 : 2008-08-26 13:38
solcomo
ls -l /bin/sh

发表于 : 2008-08-26 22:34
woohaha

代码: 全选

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2008-06-08 07:28 /bin/sh -> dash
确实是指向dash啊,那应该怎么改?
直接重建一个连接指向/bin/bash就行了?

发表于 : 2008-08-27 0:26
woohaha
我把整个脚本给大家看看,帮我改改吧。现在就是文件名空格问题和歌曲tag问题没搞好。

代码: 全选

#!/bin/bash
#This script is used for converting single APE/FLAC to multi FLACs.
#woohaha 08-08-24

declare -i count=0
declare -a filenames

if [ "$1" == "" ]; then 
#若脚本后面带有文件则执行文件,否则列出所有cue文件
 for filename in `ls *.cue`; do
   filenames[$count]=$filename
   echo "[$count]: ${filenames[$count]}"
   count=$count+1
 done
#列出所有cue文件

 echo "Which File Would You Like To Convert?"
 echo "Input Number to Select(Press Q to Exit)"
 read n
 if [ "$n" == "q" ] || [ "$n" == "Q" ]; then 
  exit 1 
 fi
#若输入Q则退出
 cuename=${filenames[$n]}

else cuename=$1 
fi

convname=${cuename}_bak
iconv -f GBK -t UTF-8 $cuename -o $convname
#为了不破坏原本的cue文件,转换编码输出成另外一个文件

Nameline=`grep FILE $convname`
#在cue文件内找到含有ape/flac文件名的行

Nametail=${Nameline#*\"}
Name=${Nametail%\"*}
#取出文件名

mkdir ${Name%.*}
cd ${Name%.*}
#创建一个与音乐文件同名的目录

shntool split -f “../$convname“ -t''%n.%t'' -o flac ”../${Name}“
#分割文件(这是核心)

rm ../$convname
#删除转换成utf-8编码的cue文件

exit 0
运行情况

代码: 全选

woohaha@woohaha-laptop:~/test$ ./Spilt-024.sh
[0]: asdfg.cue
[1]: cvcvcx.cue
[2]: lskdf
[3]: j
[4]: skdl
[5]: sldkfjkl.cue
[6]: lskdfjskdl
[7]: sldkfjkl.cue
[8]: sadfasdfasd.cue
[9]: sad
[10]: fasdf.cue
[11]: zxcvxcv.cue
Which File Would You Like To Convert?
Input Number to Select(Press Q to Exit)
q
woohaha@woohaha-laptop:~/test$ ll *.cue
-rw-r--r-- 1 woohaha woohaha 0 2008-08-24 01:31 asdfg.cue
-rw-r--r-- 1 woohaha woohaha 0 2008-08-24 01:31 cvcvcx.cue
-rw-r--r-- 1 woohaha woohaha 0 2008-08-24 15:23 lskdf j skdl sldkfjkl.cue
-rw-r--r-- 1 woohaha woohaha 0 2008-08-24 15:23 lskdfjskdl sldkfjkl.cue
-rw-r--r-- 1 woohaha woohaha 0 2008-08-24 01:31 sadfasdfasd.cue
-rw-r--r-- 1 woohaha woohaha 0 2008-08-24 15:22 sad fasdf.cue
-rw-r--r-- 1 woohaha woohaha 0 2008-08-24 01:31 zxcvxcv.cue