I have written a script to count how many records have been inserted into 3 individual HBase tables every 2 hours. I'm aware it's shoddy but it works well and i retrieve the desired results.... however I am having to invoke the HBase shell every time it works through the loop.

Is there a way to improve my code so that I don't have to do this to speed things up?

```bash
#!/bin/bash

declare -a hbaseTables=("table1" "table2" "table3");
for i in "${hbaseTables[@]}"
  do
        echo $i >> results.txt
        time=1431925200000
        for ((x=0; x<2; x=x+1))
          do
                hbase shell <<EOF | tail -2 | grep -oE "^[0-9]+" >> results.txt
                scan '$i', {TIMERANGE => [$time,$time+7199999]}
EOF
                time=$time+7200000
          done
    echo ----- >> results.txt
  done

```