Skip to main content

Shebang for Shell Scripts

To specify the interpreter for a shell script, you'll need to add a shebang at the top of the script.

Add the following to the top of your shell script to specify that it should be run with the Bash interpreter:

script.sh
#!/usr/bin/env bash
info

Using env, makes the script more flexible across different environments by not hardcoding the path.

You can replace bash with the path to another interpreter (for example, sh, zsh, etc.) if needed.