bash not finding executables on Catalina: why & how to fix?
This is due to use of the special variable PATH (in while read PATH). PATH is used by they system as a list of directories to find command executables; if it doesn't point to the usual binaries directories, the OS won't be able to find commands any more.

Solution: use a different (preferably lower- or mixed-case) name for the variable.

There are quite a few all-caps variable names with some sort of special meaning to the shell, operating system, or various commands themselves. To avoid stumbling into conflicts and unintended consequences like this, it's generally best to avoid all-caps variable names in shell scripts (unless you want the special meaning). In fact, according to the POSIX standard for environment variables:


  The name space of environment variable names containing lowercase
  letters is reserved for applications. Applications can define any
  environment variables with names from this name space without
  modifying the behavior of the standard utilities.