最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

把文件復(fù)制N份的2個(gè)Shell腳本代碼

 更新時(shí)間:2014年07月10日 09:05:33   投稿:junjie  
這篇文章主要介紹了把文件復(fù)制N份的2個(gè)Shell腳本代碼,一般用在需要大量文件測(cè)試時(shí)使用,需要的朋友可以參考下

測(cè)試時(shí)需要大量文件,所以寫了腳本進(jìn)行拷貝。有規(guī)律的文件名利于引用。


復(fù)制代碼 代碼如下:

#!/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

另一個(gè)版本

復(fù)制代碼 代碼如下:

#!/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

相關(guān)文章

最新評(píng)論

大连市| 深圳市| 右玉县| 耿马| 图们市| 崇州市| 正宁县| 多伦县| 浙江省| 瑞昌市| 沂南县| 萝北县| 融水| 江口县| 德化县| 青州市| 新泰市| 庄浪县| 剑阁县| 宁安市| 尼勒克县| 隆回县| 阿坝| 年辖:市辖区| 天津市| 青州市| 聂拉木县| 阳春市| 威远县| 黔西| 沭阳县| 涟源市| 察隅县| 永靖县| 区。| 永顺县| 玉树县| 武功县| 华池县| 沛县| 吴忠市|