Zend certified PHP/Magento developer

Determining task length for progress bar bash

I am trying to find a way how long a progress will take so i do not hard code a set time length. I am trying to do this without adding any new libraries. the pv command seems pretty popular but my system does not support it for some reason. I am assuming there is a way SIGINFO to get this information. I tried doing a while [ ! -z pgrep command ] do \logic to have it run while the task exists. This is for a load% for the following code:

 if [  "$selected_choice" == "Go Back" ]
  then gsettings set org.gnome.desktop.peripherals.keyboard repeat false && echo -en "e" #This is the escape sequence in the first menu.
  else cd && cd $search_dir && jar cf $file $fileclass & bash ~/Bash_Files/Bash_Animations/load3.sh
fi

This is the code for load3.sh

#!/bin/bash

progressBarWidth=20

# Function to draw progress bar
progressBar () {

  # Calculate number of fill/empty slots in the bar
  progress=$(echo "$progressBarWidth/$taskCount*$tasksDone" | bc -l)  
  fill=$(printf "%.0fn" $progress)
  if [ $fill -gt $progressBarWidth ]; then
    fill=$progressBarWidth
  fi
  empty=$(($fill-$progressBarWidth))

  # Percentage Calculation
  percent=$(echo "100/$taskCount*$tasksDone" | bc -l)
  percent=$(printf "%0.2fn" $percent)
  if [ $(echo "$percent>100" | bc) -gt 0 ]; then
    percent="100.00"
  fi

  # Output to screen
  ## https://unix.stackexchange.com/questions/664055/how-to-print-utf-8-symbols this is why %s and %b are used
  ## ORGINAL
  ##printf "r["
  ##printf "%${fill}s" '' | tr ' ' ▉
  ##printf "%${empty}s" '' | tr ' ' ░
  ##printf "] $percent%% - $text "
  
  #This is for GNU users as UNICODE charaters do not work on their terminal
  printf "r["
  printf "%${fill}s" '' | sed 's/ /o342o226o210/g'
  printf "%${empty}s" '' | sed 's/ /o342o226o221/g'
  printf "] $percent%% - $text "
}



## Collect task count
taskCount=33
tasksDone=0

while [ $tasksDone -le $taskCount ]; do

  # Do your task
  (( tasksDone += 1 ))

  # Can add some friendly output
  # text=$(echo "somefile-$tasksDone.dat")

  # Draw the progress bar
  progressBar $taskCount $taskDone $text

  sleep 0.01
done

echo

The logic of the code works is I am just trying to dynamically assign values to taskCount and taskDone or find a different way to calculate task start to completion.