测试时需要大量文件,所以写了脚本进行拷贝。有规律的文件名利于引用。
#!/bin/sh
# file name : batchcp.sh
# author: zhouhh
# email: ablozhou@gmail.com
# date : 2008.3.31
echo "input your file name"
read filename
echo "how many times you want copy?"
read times
echo "your file name is ${filename}, you want to copy ${times} times."
base=`echo ${filename}|cut -d "." -f 1`
ext=`echo ${filename}|cut -d "." -f 2`
for(( i=0;i<${times};i++))
do
echo "copy ${base}.${ext} to ${base}$i.${ext} ..."
cp "${base}.${ext}" "${base}$i.${ext}"
done
另一个版本
#!/bin/sh
# file name : batchcp.sh
# author: zhouhh
# email: ablozhou@gmail.com
# date : 2008.3.31
echo "input your file name"
read filename
echo "how many times you want copy?"
read times
echo "your file name is ${filename}, you want to copy ${times} times."
#find . and cut the left part of the file name using ##
ext=${filename##*.}
#find . and cut the right part of the file name using %
base=${filename%.*}
echo "base:$base"
echo "ext:$ext"
for(( i=0;i<${times};i++))
do
echo "copy ${base}.${ext} to ${base}$i.${ext} ..."
cp "${base}.${ext}" "${base}$i.${ext}"
done
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
UOS arm换源
清华源mv/etc/apt/sources.list /etc/apt/sources.list.bak备份原始...
[阅读全文]
-
-
IT基础与云计算
软路由器(IPtable)iptable是Linux上常用的防火墙软件。负载均衡负载均衡是网络基础构架的关键组件...
[阅读全文]
-
-
嵌入式行业职位分析
嵌入式开发涵盖硬件软件,开发链条很长,要根据自己的实际情况选择适应的职位。嵌入式的职位大概有:1、硬件工程师:负...
[阅读全文]
-
-
-
网友评论