#!/bin/sh-t file 3 4
#
OPT_T=false
OPT_V=false
OPT_N=false
SN=0
#
while getopts tvn OPTIONS
do
case $OPTIONS in
t)
OPT_T=true
SN=`expr $SN + 1`
;;
n)
OPT_N=true
SN=`expr $SN + 1`
;;
v)
OPT_V=true
SN=`expr $SN + 1`
;;
esac
done
#
while [ $SN -gt 0 ]
do
shift
SN=`expr $SN - 1`
done
#
FP=$1
FP=${FP:="NULL"}
if [ $FP = "NULL" ]
then
echo -n "Please, enter prefix of name of file: "
read FP
fi
#
#!!!!!!!! Assful Check
#expr $FN + 1 3>&4
MINSZ=$2
MINSZ=${MINSZ:="NULL"}
if [ $MINSZ = "NULL" ]
then
echo -n "Please, enter minimal size of file: "
read MINSZ
fi
#
MAXSZ=$3
MAXSZ=${MAXSZ:="NULL"}
if [ $MAXSZ = "NULL" ]
then
echo -n "Please, enter maximal size of file: "
read MAXSZ
fi
#
for CF in `wc -c $FP* | awk '{print $2}'`
do
if [ $CF != 'total' ]
then
FSZ=`wc -c $CF | awk '{print $1}'`
if [ "$FSZ" -le "$MAXSZ" ] && [ "$FSZ" -ge "$MINSZ" ]
then
rm $CF
fi
fi
done
#
OPT_T=false
OPT_V=false
OPT_N=false
SN=0
echo $OPTIONS
while getopts tvn OPTIONS
do
case $OPTIONS in
t)
OPT_T=true
SN=`expr $SN + 1`
;;
n)
OPT_N=true
SN=`expr $SN + 1`
;;
v)
OPT_V=true
SN=`expr $SN + 1`
;;
esac
done
while [ $SN -gt 0 ]
do
shift
SN=`expr $SN - 1`
done
FN=$1
FN=${FN:="NULL"}
if [ $FN = "NULL" ]
then
echo -n "Please, enter name of file: "
read FN
fi
#
Assful Check
expr $FN + 1 3>&4
#
PF=$2
PF=${PF:="NULL"}
if [ $PF = "NULL" ]
then
echo -n "Please, enter postfix of first copie: "
read PF
fi
#
LE=$3
LE=${LE:="NULL"}
if [ $LE = "NULL" ]
then
echo -n "Please, enter the number of copies: "
read LE
fi
#
LI="1"
while [ "$LI" -le "$LE" ]
do
cp $FN "${FN}${PF}"
PF=`echo $PF | tr '1-9a-zA-Y' '2-9a-zA-Z'`
LI=`expr $LI + 1`
done
#
exit 0