Bash Script shebang

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • Use /bin/bash as the bash interpreter:

    #!/bin/bash

  • Search the bash interpreter in the PATH environment variable with envexecutable:

    #!/usr/bin/env bash

Remarks

A common mistake is to try to execute Windows end-line formatted \r\n script files on UNIX/Linux systems, in this case the used script interpreter in the shebang is:

/bin/bash\r

And is obliviously not found but can be hard to figure out.



Got any Bash Question?