This two-characters sequence #! is called a shebang. It is used in shell scripts to determine which interpreter should be used to run the script.

It’s a good idea to include a shebang #! at the top of a Bash file. This is so that the sript runs correctly regardless of what shell the user is running.

For example, if a user is using the zsh shell, the script would default to zsh syntax instead of the intended bash syntax. Adding a shebang prevents this issue.

This also means you don’t have to include the .sh file extension.

#!/usr/bin/env bash

Reference: What is the preferred bash shebang