Script to check to see if certain applications were installed
There are several ways via the command line to look to see if an Application is installed:
View the Applications Directory

To list all Applications installed system wide:
  $ ls /Applications                    


To list Applications installed by/for a specific user:
  $ ls /Users/&lt;username&gt;/Applications  



Query system_profiler
The following command will list every single Application installed on the system that's in the Applications database:
$ system_profiler SPApplicationsDataType

It lists everything including obscure apps/utilities installed by Apple (or 3rd parties) that was included with the macOS installation.  Using grep we can limit it to a particular application.
$ system_profiler SPApplicationsDataType | grep -i Excel
    Microsoft Excel:
      Location: /Applications/Microsoft Excel.app

The caveat with these is that it must have been &quot;properly&quot; installed and registered with the system.  If you happen to download a binary directly from a website (ffmpeg is an excellent example), it won't show up using any of these methods.
Use which or type
For binaries that weren't installed, but rather just downloaded or copied onto a system and assuming they are in the path, you can use the command which or type
$ which ffmpeg
/usr/local/bin/ffmpeg

$ type ffmpeg
ffmpeg is /usr/local/bin/ffmpeg