Use /usr/bin/env in Shell Scripts When writing shell scripts, avoid hardcoding the full path to the shell. Instead, use the environment path to make your script more portable across different systems.

#!/usr/bin/env bash

#!/usr/bin/bash

Using env ensures the system uses the correct version of the shell from the user’s environment.