メモ:ディレクトリをコピーするだけのシェルスクリプト
#!/bin/sh
#dummycopy.sh
if [ $# -ne 3 ]
then
echo "dummycopy.sh arg1 arg2 arg3"
echo "arg1:startpoint"
echo "arg2:endpoint"
echo "arg3:copy file or directry path"
exit 1
fi
declare -i startpoint
startpoint=$1
declare -i endpoint
endpoint=$2
copypath=$3
if [ $startpoint -ge $endpoint ]
then
echo "arg1 must be less than arg2" 1<&2
exit 1
fi
declare -i counter
counter=$startpoint
echo "copy ${startpoint} to ${endpoint}"
while [ $counter -lt $endpoint ]
do
echo "${copypath}${counter} copy now."
`cp -R -p ${copypath} ${copypath}${counter}`
echo "${copypath}${counter} O.K."
counter=`expr $counter+1`
done
使い方的には
dummycopy.sh 1 201 test
みたいな感じに使うと、testをtest1からtest200迄のディレクトリをコピーするのよね。
0 件のコメント:
コメントを投稿