Bash script that checks for package dependencies and installs them if necessary
Instead of this:


    if [ $(dpkg-query -W -f='${Status}' $i 2&gt;/dev/null | grep -c "ok installed") -eq 0 ]; then



A better way to write the same thing:

    if ! dpkg-query -W -f='${Status}' $i 2&gt;/dev/null | grep -q "ok installed"; then


Instead of this:


        if [ "$response" == "y" ] || [ "$response" == "Y" ]; then



A simpler way to write is:

        if [[ $response == [yY]* ]]; then


This is not example the same. It will match anything that starts with "y" or "Y". If you want to match strictly only those letters, just drop the * from the pattern:

        if [[ $response == [yY] ]]; then


Finally,
all the ; at line endings are unnecessary.
The purpose of ; is to separate multiple statements on the same line.
Line breaks naturally serve as statement separators.