You can check if a program exists from a Bash script using the command, type command or Which Is command followed by the name of the program you want to check.

1. command -v:
Here's an example using the command command:

if command -v program_name >/dev/null 2>&1; then
    echo "Program exists"
else
    echo "Program does not exist"
fi

The command -v program_name command will return the path to the program if it exists, or an empty string if it does not exist. The >/dev/null 2>&1 portion redirects any output to /dev/null, which essentially discards it. This makes the output of the command completely silent.

If the program exists, the exit status of the command command will be 0, which is considered a success in Bash. If the program does not exist, the exit status will be 1, which is considered a failure in Bash. The if statement checks the exit status and prints a message accordingly.

2. type command:

You can also use the type command in a similar way:
if type -p program_name >/dev/null 2>&1; then
    echo "Program exists"
else
    echo "Program does not exist"
fi

The type -p program_name command will return the path to the program if it exists, or nothing if it does not exist. The rest of the script is the same as the previous example.

3. Which Is command:

You can also check if a program exists from a Bash script by using the which command. The which command will search for the specified program in the directories listed in the $PATH environment variable. Here is an example script that checks if the ls program exists:
#!/bin/bash

if which ls >/dev/null 2>&1; then
    echo "ls program exists"
else
    echo "ls program does not exist"
fi

In this script, the which ls command searches for the ls program in the $PATH directories. If ls is found, the command returns a 0 exit status, which means success. The >/dev/null 2>&1 redirects the command's output to /dev/null, which discards it, and redirects the error output to the same place. The if statement then checks the exit status of the which command and prints an appropriate message.