Shell Script Example – Linux

Shell Script Example – Linux

for ((j=12;j<=31;j++));
do
echo $j

year=2020
month=01
day=$j

mkdir /mnt/recording/final/11/$year-$month-$day

results=($(mysql –user name -ppassword -h 192.168.2.4 db -Bse “SELECT id FROM calldetails  WHERE calldate BETWEEN ‘$year-$month-$day 00:00:00’ AND ‘$year-$month-$day 23:00:00′”))

cnt=${#results[@]}
for (( i=0 ; i<cnt ; i++ ))
do
a=${results[$i]}
echo auid=$a;
cp /home/data/$year-$month-$day/$a.gsm /mnt/recording/final/11/$year-$month-$day/$a.gsm
done
done