In your script, these two lines close to the top should do the trick:
LD_LIBRARY_PATH="$(pwd)/lib"
export LD_LIBRARY_PATH
Although `bash` allows you to set and export a variable in a single statement, not all shells do, so the two step approach is more portable, if that's a concern.
If this isn't working for you, check that you are running the script from the right place - using `$(pwd)` like this ties you to running the script from the directory that contains the required `./lib` subdirectory.
If you want to be able to run the script from anywhere, you need to use the absolute path to the `./lib` subdir, or construct a relative path from the directory portion of the path to the script using, e.g., `$(dirname $0)`